[jboss-user] [EJB 3.0] - Re: Dependency injection is not working

daviddev do-not-reply at jboss.com
Tue Jul 7 08:14:17 EDT 2009


Hi,

thanks for answering.

I did try to use only the name of the property within the env-entry definition ass you mentioned but I still have the same problem. Even worth, the message driven bean are not properly initialised. I need to do a look up of the context to get the appropriate value of the application name. 

in summary, if i do not include the package tath within the env-entry e.g.

  | <env-entry-name>applicationName</env-entry-name>
  | 
I need to lookup the context to get the application name set in the ejb-jar.xml. here the code in my session of my bean


  | //...
  | try {
  | 	Context ctx = new InitialContext();
  | 	Context envContext = (Context) ctx.lookup( "java:comp/env" );
  | 	String appName = (String) envContext.lookup( "applicationName" );
  | 	this.applicationName = appName;
  | 			 
  | } catch (NamingException e){
  | 	log.debug( "application name not found" );
  | }
  | 

if I include the full package path

  | <env-entry-name>com.messaging.messagemanager.receiving.IncomingMessageHandler/applicationName</env-entry-name>
  | 

I do not need to do a look up within my message driven bean.

However within the other beans the injection does not work.

I am not sure to understand how the injection work

Thanks for you help



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242165#4242165

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242165



More information about the jboss-user mailing list