[webbeans-issues] [JBoss JIRA] Commented: (WBRI-329) NPE in org.jboss.webbeans.ejb.SessionBeanInterceptor @PostConstruct
Pete Muir (JIRA)
jira-events at lists.jboss.org
Thu Aug 6 07:25:29 EDT 2009
[ https://jira.jboss.org/jira/browse/WBRI-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12479227#action_12479227 ]
Pete Muir commented on WBRI-329:
--------------------------------
On 5 Aug 2009, at 18:56, Kenneth Saks wrote:
> Can you elaborate on this a bit? How exactly are the injection responsibilities
> for a class divided up between the glassfish container and the 299 runtime?
> Let's say I have :
>
> @Stateless
> public class FooBean {
>
> @Resource
> private String foo;
>
> @EJB
> private Bar bar;
>
> // injection specified via ejb-jar.xml
> private Bar bar2;
>
> @UserDatabase
> private EntityManager em;
>
> @PostConstruct
> void init() { ... }
>
> }
> GlassFish would just ignore "em" but would inject the other three fields
> and call PostConstruct. My assumption is that 299 only has responsibility
> for injecting em. How are you expecting this to be coordinated?
> NPE in org.jboss.webbeans.ejb.SessionBeanInterceptor @PostConstruct
> -------------------------------------------------------------------
>
> 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
>
> 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
--
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
More information about the weld-issues
mailing list