[jbossseam-issues] [JBoss JIRA] Resolved: (JBSEAM-456) Interceptor tries to access UserTransaction interface, but this is not allowed for CMT

Gavin King (JIRA) jira-events at jboss.com
Mon Nov 13 12:04:42 EST 2006


     [ http://jira.jboss.com/jira/browse/JBSEAM-456?page=all ]

Gavin King resolved JBSEAM-456.
-------------------------------

    Resolution: Done

Well, then this is a bug in Glassfish, not Seam, since the EJB spec says:

"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 UserTransaction
interface attempts to look up the interface in JNDI using the JNDI APIs."

And that is the behavior in JBoss, and the behavior expected by Seam:

   public static boolean isTransactionActive() throws SystemException, NamingException
   {
      try
      {
         return getUserTransaction().getStatus()==STATUS_ACTIVE;
      }
      catch (NamingException ne)
      {
         try
         {
            return !EJB.getEJBContext().getRollbackOnly();
         }
         catch (IllegalStateException ise)
         {
            return false;
         }
      }
   }

So I suggest you report this bug to the Glassfish team. Nevertheless I will code a workaround for the bug in the Seam Transactions class.

> Interceptor tries to access UserTransaction interface, but this is not allowed for CMT
> --------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-456
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-456
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.0.BETA1
>         Environment: Glassfish
>            Reporter: Guy Veraghtert
>         Assigned To: Gavin King
>            Priority: Critical
>             Fix For: 1.1.0.BETA2
>
>
> In method getEntityManager() in class ManagedPersistenceContext a call is made to the UserTransaction interface: getStatus(). According to the EJB 3.0 specification (p.81) this is not allowed for CMT. Seam requires the usage of CMT.
> (Occurs when adding @In to an entityManager-field, according to seam doc 11.4).
> Patched locally in class ManagedPersistenceContext :
>    @Unwrap
>    public EntityManager getEntityManager() throws NamingException, SystemException
>    {
>       if ( !Lifecycle.isDestroying() /*&& Transactions.isTransactionActive()*/ )
>       {
>          try
>          {
>             entityManager.joinTransaction();
>          } catch (TransactionRequiredException e) {
>             
>          }
>       }
>       return entityManager;
>    }

-- 
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