[
https://jira.jboss.org/jira/browse/WBRI-329?page=com.atlassian.jira.plugi...
]
Pete Muir updated WBRI-329:
---------------------------
Summary: Move EJB injection to InjectionTarget (was: NPE in
org.jboss.webbeans.ejb.SessionBeanInterceptor @PostConstruct)
Fix Version/s: 1.0.0.CR1
Description: Currently we perform 299 style injection into EJBs via an interceptor,
I would prefer to move this to use the InjectionTarget SPI. (was: SessionBeanInterceptor
@PostConstruct is throwing an NPE when the ejb container creates an instance of any
session bean component type. The trace below is for a Singleton. These are all cases
where there is no 299-specific interaction that causes the bean instance creation.
It's just the ejb container creating the instance through some other path , e.g. to
eagerly instantiate the Singleton during application startup or to resolve a direct JNDI
lookup() from some application code. I haven't tried a stateful session bean
creation via 299-apis or injection yet.
SessionBeanInterceptor.initBean() first calls (EnterpriseBean<Object>)
EnterpriseBeanProxyMethodHandler.getEnterpriseBean(), which returns null.
It then calls (EnterpriseBean<Object>)
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(beanClass), which also returns
null. That leads to the NPE on the line "this.beanId = this.bean.getId();"
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbApplication start
method
javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton
SimpleSingleton
at
com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:689)
at
com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:432)
at
org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:93)
at
org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:62)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:138)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:223)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:193)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:290)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:174)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:270)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$4.execute(CommandRunnerImpl.java:422)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:437)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:524)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:140)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:313)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:180)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:208)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:752)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:660)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:911)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:164)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.NIOContext.execute(NIOContext.java:510)
at
com.sun.grizzly.SelectorHandlerRunner.handleSelectedKey(SelectorHandlerRunner.java:357)
at
com.sun.grizzly.SelectorHandlerRunner.handleSelectedKeys(SelectorHandlerRunner.java:257)
at com.sun.grizzly.SelectorHandlerRunner.doSelect(SelectorHandlerRunner.java:194)
at com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:129)
at com.sun.grizzly.util.FixedThreadPool$BasicWorker.dowork(FixedThreadPool.java:379)
at com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:360)
at java.lang.Thread.run(Thread.java:637)
Caused by: javax.ejb.CreateException: Initialization failed for Singleton SimpleSingleton
at
com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:521)
at
com.sun.ejb.containers.AbstractSingletonContainer.access$100(AbstractSingletonContainer.java:70)
at
com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:687)
... 37 more
Caused by: java.lang.NullPointerException
at
org.jboss.webbeans.ejb.SessionBeanInterceptor.initBean(SessionBeanInterceptor.java:110)
at
org.jboss.webbeans.ejb.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:62)
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:597)
at
com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:939)
at
com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:372)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:355)
at
com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:514)
... 39 more
)
The original issue reported by Ken has sparked this move. His original report is
SessionBeanInterceptor @PostConstruct is throwing an NPE when the ejb container creates an
instance of any session bean component type. The trace below is for a Singleton. These
are all cases where there is no 299-specific interaction that causes the bean instance
creation. It's just the ejb container creating the instance through some other path
, e.g. to eagerly instantiate the Singleton during application startup or to resolve a
direct JNDI lookup() from some application code. I haven't tried a stateful session
bean creation via 299-apis or injection yet.
SessionBeanInterceptor.initBean() first calls (EnterpriseBean<Object>)
EnterpriseBeanProxyMethodHandler.getEnterpriseBean(), which returns null.
It then calls (EnterpriseBean<Object>)
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(beanClass), which also returns
null. That leads to the NPE on the line "this.beanId = this.bean.getId();"
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbApplication start
method
javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton
SimpleSingleton
at
com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:689)
at
com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:432)
at
org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:93)
at
org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:62)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:138)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:223)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:193)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:290)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:174)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:270)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$4.execute(CommandRunnerImpl.java:422)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:437)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:524)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:140)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:313)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:180)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:208)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:752)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:660)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:911)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:164)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.NIOContext.execute(NIOContext.java:510)
at
com.sun.grizzly.SelectorHandlerRunner.handleSelectedKey(SelectorHandlerRunner.java:357)
at
com.sun.grizzly.SelectorHandlerRunner.handleSelectedKeys(SelectorHandlerRunner.java:257)
at com.sun.grizzly.SelectorHandlerRunner.doSelect(SelectorHandlerRunner.java:194)
at com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:129)
at com.sun.grizzly.util.FixedThreadPool$BasicWorker.dowork(FixedThreadPool.java:379)
at com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:360)
at java.lang.Thread.run(Thread.java:637)
Caused by: javax.ejb.CreateException: Initialization failed for Singleton SimpleSingleton
at
com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:521)
at
com.sun.ejb.containers.AbstractSingletonContainer.access$100(AbstractSingletonContainer.java:70)
at
com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:687)
... 37 more
Caused by: java.lang.NullPointerException
at
org.jboss.webbeans.ejb.SessionBeanInterceptor.initBean(SessionBeanInterceptor.java:110)
at
org.jboss.webbeans.ejb.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:62)
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:597)
at
com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:939)
at
com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:372)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:355)
at
com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:514)
... 39 more
Move EJB injection to InjectionTarget
-------------------------------------
Key: WBRI-329
URL:
https://jira.jboss.org/jira/browse/WBRI-329
Project: Web Beans
Issue Type: Bug
Components: Enterprise Beans, Glassfish integration
Environment: 1.0.0.PREVIEW2.SP2 in 7/30/09 GlassFish V3 workspace
Reporter: Ken Saks
Fix For: 1.0.0.CR1
Currently we perform 299 style injection into EJBs via an interceptor, I would prefer to
move this to use the InjectionTarget SPI.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira