[
https://issues.jboss.org/browse/JBAS-8733?page=com.atlassian.jira.plugin....
]
Nicklas Karlsson commented on JBAS-8733:
----------------------------------------
With a bean like
@Stateful
@Named
public class Test
{
@PersistenceContext(type = PersistenceContextType.EXTENDED)
EntityManager em;
@PostConstruct
public void init()
{
em.createQuery("select f from Foo f").getSingleResult();
}
public String getPing()
{
return "ping";
}
}
against the DefaultDS , EL-referenced I get a
java.lang.NullPointerException
org.jboss.ejb3.entity.ExtendedEntityManager.getPersistenceContext(ExtendedEntityManager.java:76)
org.jboss.ejb3.entity.ExtendedEntityManager.getEntityManager(ExtendedEntityManager.java:61)
org.jboss.ejb3.jpa.integration.JPA1EntityManagerDelegator.createQuery(JPA1EntityManagerDelegator.java:76)
fi.nik.jsf.Test.init(Test.java:20)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.ejb3.interceptors.aop.LifecycleCallbackBeanMethodInterceptor.invoke(LifecycleCallbackBeanMethodInterceptor.java:69)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:129)
org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doPostConstruct(Jsr299BindingsInterceptor.java:69)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodLazyInterceptor.invoke(LifecycleCallbackInterceptorMethodLazyInterceptor.java:109)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
org.jboss.weld.integration.ejb.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:101)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodLazyInterceptor.invoke(LifecycleCallbackInterceptorMethodLazyInterceptor.java:109)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1517596939.invoke(InvocationContextInterceptor_z_setup_1517596939.java)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80)
org.jboss.ejb3.interceptors.container.AbstractContainer.invokeCallback(AbstractContainer.java:258)
org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1351)
org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1362)
org.jboss.ejb3.stateful.StatefulContainer.create(StatefulContainer.java:157)
org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:402)
org.jboss.ejb3.stateful.StatefulContainer.createSession(StatefulContainer.java:413)
org.jboss.ejb3.nointerface.impl.view.factory.StatefulNoInterfaceViewFacade.createNoInterfaceView(StatefulNoInterfaceViewFacade.java:115)
org.jboss.ejb3.nointerface.impl.objectfactory.StatefulNoInterfaceViewObjectFactory.getObjectInstance(StatefulNoInterfaceViewObjectFactory.java:73)
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
javax.naming.InitialContext.lookup(InitialContext.java:392)
org.jboss.weld.integration.ejb.JBossSessionObjectReference.<init>(JBossSessionObjectReference.java:44)
org.jboss.weld.integration.ejb.JBossEjbServices.resolveEjb(JBossEjbServices.java:67)
org.jboss.weld.bean.SessionBean.createReference(SessionBean.java:452)
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.<init>(EnterpriseBeanProxyMethodHandler.java:76)
org.jboss.weld.bean.SessionBean.create(SessionBean.java:327)
org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:59)
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:669)
org.jboss.weld.el.AbstractWeldELResolver$1.call(AbstractWeldELResolver.java:125)
org.jboss.weld.el.ELCreationalContext.putIfAbsent(ELCreationalContext.java:63)
org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:120)
org.jboss.weld.integration.webtier.jsf.ForwardingELResolver.getValue(ForwardingELResolver.java:51)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:71)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:67)
org.apache.el.parser.AstValue.getValue(AstValue.java:115)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187)
org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:106)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
javax.faces.component.UIOutput.getValue(UIOutput.java:164)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:351)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:160)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)
Is the persistence context not well-defined in post-constructs according to the spec?
Extended persistence context not available in @PostConstruct method
of stateful EJB
-----------------------------------------------------------------------------------
Key: JBAS-8733
URL:
https://issues.jboss.org/browse/JBAS-8733
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB3
Affects Versions: 6.0.0.CR1
Reporter: Nicklas Karlsson
Assignee: Carlo de Wolf
Trying to use an extended @PersistenceContext injected em from a @PostConstruct method in
a session bean results in a NPE
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira