Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Major
-
Resolution: Done
-
Affects Version/s: 3.1.0.Beta4
-
Fix Version/s: 3.1.0.CR1
-
Labels:None
-
Environment:Seam 3.1.0.beta4
GlassFish 3.1.1/3.1.2.b10
Weld 1.1.3.Final/1.1.4-SNAPSHOT(build: 2011-11-22)
JDK 1.6.0_29
Windows XP SP3
Description
When use SMPC(Seam Managed Persistence Context) within a session bean(stateless or stateful),
NamingException was thrown from DefaultSeamTransaction line 123 and line 143.
This issue cause the sentence from line 144 to line 154 never been invoked.
DefaultSeamTransaction should catch NamingException instead of NameNotFoundException (need modify at line 143).
When use SMPC(Seam Managed Persistence Context) within a pojo bean, no exception was thrown.
In addition, the case that SMPC can't use within session bean should be announced in the Seam Reference Documentation.
In other word, I found that SMPC is incompatible with SessionBean in GlassFish.
=============
Caused by: java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'java:comp/UserTransaction' in SerialContext[myEnv=
{java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans]at org.jboss.seam.transaction.DefaultSeamTransaction.getSeamTransaction(DefaultSeamTransaction.java:123)
at org.jboss.seam.transaction.DefaultSeamTransaction.isActive(DefaultSeamTransaction.java:52)
at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.joinTransaction(ManagedPersistenceContextProxyHandler.java:113)
at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.invoke(ManagedPersistenceContextProxyHandler.java:102)
at $Proxy832.createQuery(Unknown Source)
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 org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
at org.jboss.weld.proxies.EntityManager$FullTextEntityManager$ManagedPersistenceContext$-633155436$Proxy$$$_WeldClientProxy.createQuery(EntityManager$FullTextEntityManager$ManagedPersistenceContext$-633155436$Proxy$$$_WeldClientProxy.java)
at com.hantsylabs.seam3sandbox.view.PostHome.getDataModel(PostHome.java:34)
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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5382)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:42)
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.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5354)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5342)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
... 84 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/UserTransaction' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
[Root exception is javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.seam.transaction.DefaultSeamTransaction.getUserTransaction(DefaultSeamTransaction.java:142)
at org.jboss.seam.transaction.DefaultSeamTransaction.createUTTransaction(DefaultSeamTransaction.java:136)
at org.jboss.seam.transaction.DefaultSeamTransaction.getSeamTransaction(DefaultSeamTransaction.java:113)
... 117 more
Caused by: javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans
at com.sun.ejb.containers.BaseContainer.checkUserTransactionLookup(BaseContainer.java:838)
at com.sun.ejb.EjbInvocation.userTransactionLookupAllowed(EjbInvocation.java:427)
at com.sun.enterprise.transaction.TransactionNamingProxy.checkUserTransactionLookupAllowed(TransactionNamingProxy.java:162)
at com.sun.enterprise.transaction.TransactionNamingProxy.handle(TransactionNamingProxy.java:135)
at com.sun.enterprise.naming.impl.NamedNamingObjectManager.tryNamedProxies(NamedNamingObjectManager.java:89)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:174)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)
... 123 more
The following is an excerpt from "JSR-000318 Enterprise JavaBeans 3.1 Proposed Final Draft Specification".
(http://download.oracle.com/otndocs/jcp/ejb-3.1-pfd-oth-JSpec/)
section 4.6.1 (page 95)
The UserTransaction interface is unavailable to enterprise beans with container-managed transaction demarcation.
section 16.12 (page 473)
The container must not make the UserTransaction interface available to the enterprise beans that are not allowed to use this interface. The container should throw javax.naming.NameNotFoundException if an instance of an enterprise bean that is not allowed to use the UserTransactioninterface attempts to look up the interface in JNDI using the JNDI APIs.