[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1688) SMPC is broken on Glassfish
Guy Veraghtert (JIRA)
jira-events at lists.jboss.org
Wed Jul 18 12:34:47 EDT 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-1688?page=comments#action_12369341 ]
Guy Veraghtert commented on JBSEAM-1688:
----------------------------------------
I did some further debugging. I'm getting a CMTTransaction because there is an EJBContext!
When Transaction.instance() is called in the SeamPhaseListener, an EJB is called, namely org.jboss.seam.transaction.EjbTransaction, which is a SFSB. Because of your fix in the getUserTransaction() (the call to getStatus()), an IllegalStateException is thrown. This results in a JNDI lookup for java:comp/UserTransaction, Glassfish detects the EJBContext and throws a NameNotFoundException, which in its return causes the creation of a CMTTransaction.
Here is the call stack of Transaction.instance() in the SeamPhaseListener:
at com.sun.enterprise.distributedtx.UserTransactionImpl.checkUserTransactionMethodAccess(UserTransactionImpl.java:135)
at com.sun.enterprise.distributedtx.UserTransactionImpl.getStatus(UserTransactionImpl.java:262)
at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:139)
at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:131)
at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:104)
at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2884)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3975)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127)
at $Proxy186.getTransaction(Unknown Source)
at sun.reflect.GeneratedMethodAccessor269.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
at org.javassist.tmp.java.lang.Object_$$_javassist_0.getTransaction(Object_$$_javassist_0.java)
at sun.reflect.GeneratedMethodAccessor271.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
at org.jboss.seam.Component.callComponentMethod(Component.java:1972)
at org.jboss.seam.Component.unwrap(Component.java:1998)
at org.jboss.seam.Component.getInstance(Component.java:1785)
at org.jboss.seam.Component.getInstance(Component.java:1750)
at org.jboss.seam.Component.getInstance(Component.java:1727)
at org.jboss.seam.Component.getInstance(Component.java:1722)
at org.jboss.seam.transaction.Transaction.instance(Transaction.java:96)
at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:301)
at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> SMPC is broken on Glassfish
> ---------------------------
>
> Key: JBSEAM-1688
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1688
> Project: JBoss Seam
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.0.BETA1
> Environment: Glassfish v2-b50g (beta3), Windows XP
> Reporter: Guy Veraghtert
> Assigned To: Gavin King
> Fix For: 2.0.0.CR1
>
> Attachments: JBSEAM-1688.zip
>
>
> (this issue is related to http://jira.jboss.org/jira/browse/JBSEAM-456, regression!)
> Adding @In to an entityManager-field to a SFSB causes a java.lang.IllegalStateException: Operation not allowed on Glassfish.
> In org.jboss.seam.transaction.Transaction the UserTransaction is retrieved via
> Naming.getInitialContext().lookup("UserTransaction");
> Glassfish doesn't throw a NameNotFoundException in this case but just returns the UserTransaction instance (according to the glassfish guys, a NameNotFoundException should only be thrown when lookup is done via "java:comp/..." (see https://glassfish.dev.java.net/issues/show_bug.cgi?id=3356)).
> When later on getStatus() is called on the retrieved UserTransaction instance, following exception is thrown:
> java.lang.IllegalStateException: Operation not allowed.
> at com.sun.enterprise.distributedtx.UserTransactionImpl.checkUserTransactionMethodAccess(UserTransactionImpl.java:135)
> at com.sun.enterprise.distributedtx.UserTransactionImpl.getStatus(UserTransactionImpl.java:262)
> at org.jboss.seam.transaction.UTTransaction.getStatus(UTTransaction.java:70)
> at org.jboss.seam.transaction.AbstractUserTransaction.isActive(AbstractUserTransaction.java:24)
> at org.jboss.seam.persistence.ManagedPersistenceContext.joinTransaction(ManagedPersistenceContext.java:120)
> at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:111)
> 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.seam.util.Reflections.invoke(Reflections.java:21)
> at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
> at org.jboss.seam.Component.callComponentMethod(Component.java:1975)
> at org.jboss.seam.Component.unwrap(Component.java:2001)
> at org.jboss.seam.Component.getInstance(Component.java:1788)
> at org.jboss.seam.Component.getInstance(Component.java:1741)
> at org.jboss.seam.Component.getValueToInject(Component.java:2026)
> at org.jboss.seam.Component.injectAttributes(Component.java:1499)
> at org.jboss.seam.Component.inject(Component.java:1320)
>
> When we change the implementation of getUserTransaction() to:
> (why isn't this the default implementation anyway??)
> protected javax.transaction.UserTransaction getUserTransaction() throws NamingException
> {
> return (javax.transaction.UserTransaction) Naming.getInitialContext().lookup(STANDARD_USER_TRANSACTION_NAME);
> }
> a NameNotFoundException is thrown, and a CMTTransaction is created in the getTransaction() method.
> However, then following exception is thrown:
> java.lang.IllegalStateException: ERROR: only SessionBeans with bean-managed transactionscan obtain UserTransaction
> at com.sun.ejb.containers.BaseContainer.getUserTransaction(BaseContainer.java:752)
> at com.sun.ejb.containers.SessionContextImpl.getUserTransaction(SessionContextImpl.java:198)
> at org.jboss.seam.transaction.CMTTransaction.getStatus(CMTTransaction.java:92)
> at org.jboss.seam.transaction.AbstractUserTransaction.isActive(AbstractUserTransaction.java:24)
> at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:576)
> at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
> at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
> at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
> at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
> at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> Even worse, an endless redirect happens then, due to the ExceptionHandler responsible for an IllegalStateException.
--
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
More information about the seam-issues
mailing list