[jboss-dev-forums] [Design of EJB 3.0] - @EJB Injection Not Working
ALRubinger
do-not-reply at jboss.com
Tue Sep 19 17:47:26 EDT 2006
After upgrading today my JBoss 4.0.4-GA installation to EJB3 RC9, I've found that the @EJB injections in my code are not populating my instance variables as they had been previous to the upgrade.
I have created a project with sources, build script, and deployable example of the use case. Will be happy to upload/email this if instructed.
I'd like to volunteer to fix if confirmed that this is a bug and can be shown proper branches in JBoss source to correct.
S,
ALR
Partial Code Listing from Use Case Project
package com.alrubinger.jboss.usecase.ejbinjectionfailure;
|
| import javax.annotation.EJB;
|
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jboss.annotation.ejb.Depends;
| import org.jboss.annotation.ejb.LocalBinding;
| import org.jboss.annotation.ejb.RemoteBinding;
| import org.jboss.annotation.ejb.Service;
|
| @Service(objectName = "alrubinger:service=ServiceA")
| @Depends( { "alrubinger:service=ServiceB" })
| @LocalBinding(jndiBinding = "alrubinger/service/serviceA/local")
| @RemoteBinding(jndiBinding = "alrubinger/service/serviceA/remote")
| public class ServiceABean implements ServiceA, ServiceAManagement {
|
| // Class Members
| private static final Log logger = LogFactory.getLog(ServiceABean.class);
|
| // Instance Members
| @EJB
| private ServiceB injectedReference;
|
| // Required Implementations
|
| /**
| * Test Method
| */
| public String test() {
| return "SUCCESSFUL TEST SERVICE A";
| }
|
| // Lifecycle Methods
| /*
| * (non-Javadoc)
| *
| * @see com.alrubinger.jboss.usecase.ejbinjectionfailure.EjbAManagement#start()
| */
| public void start() throws Exception {
| logger.info("In start...");
| logger.info("Calling injected reference...");
| // >>> NULLPOINTER DUE TO NO INJECTION <<<
| logger.info(injectedReference.test());
| // THIS LINE NOT REACHED
| logger.info("Start Done; OK.");
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972756#3972756
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972756
More information about the jboss-dev-forums
mailing list