Injection using @Resource of SessionContext fails with NullPointerException while
deploying the application
-----------------------------------------------------------------------------------------------------------
Key: EJBTHREE-664
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-664
Project: EJB 3.0
Issue Type: Bug
Affects Versions: EJB 3.0 RC8 - FD
Environment: JBoss-4.0.4GCA, jboss-EJB-3.0_RC8-FD, Java: jdk1.5.0_07
Reporter: jaikiran pai
Attachments: Exception Stacktrace.txt, MyEJB3.ear, source.zip
I have StatelessSessionBean in which i am trying to inject the SessionContext. When i am
trying to deploy the bean, server throws exceptions indicating a NullPointerException and
subsequently the application is not deployed.
Here's a small extract from the exception stacktrace(The entire exception stacktrace
is attached to this issue):
12:52:11,816 INFO [EARDeployer] Init J2EE application:
file:/D:/JBoss4.0.4GCA/jboss-4.0.4.GA/server/default/deploy/MyEJB3.ear/
12:52:12,160 INFO [Ejb3Deployment] EJB3 deployment time took: 188
12:52:12,270 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3 with dependencies:
12:52:12,691 WARN [ServiceController] Problem starting service
jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
java.lang.NullPointerException
at org.jboss.ejb3.injection.ResourceHandler.loadFieldInjectors(ResourceHandler.java:283)
at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:401)
at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:381)
at org.jboss.ejb3.EJBContainer.resolveInjectors(EJBContainer.java:640)
at org.jboss.ejb3.EJBContainer.initializePool(EJBContainer.java:576)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:507)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:82)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
12:52:13,785 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
I am using JBoss - 4.0.4 GCA. I followed the following steps after installing the server:
1) I downloaded jboss-EJB-3.0_RC8-FD
2) Copied ejb3-persistence.jar in server/default/lib
3) Copied ejb3-interceptors-aop.xml in server/default/deploy
4) ejb3.deployer in server/default/deploy
Note that with the injection part commented out, everything works fine, the EJB gets
deployed and i am able to invoke methods on the EJB.
I have attached the source code and the .ear file along with this issue for reference.
Just place the MyEJB3.ear file in the %JBOSS_HOME%/server/default/deploy directory, after
following the steps mentioned above, and start the server to reproduce the issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira