1 Reply Latest reply on Feb 4, 2008 10:06 AM by Daniel MacLaren

    Seam + Informix - java.lang.IllegalStateException

    Daniel MacLaren Newbie

      I have written an application using Seam & MySQL which is working. I am now trying to connect the application to Informix and I am getting the following exceptions:

      10:42:15,676 INFO [AuthenticatorAction] authenticating admin
      10:42:16,841 INFO [STDOUT] Hibernate:
       select
       user0_.id as id6_,
       user0_.username as username6_,
       user0_.password as password6_,
       user0_.salt as salt6_,
       user0_.email as email6_,
       user0_.role as role6_
       from
       uv_user user0_
       where
       user0_.username=?
      10:42:16,912 INFO [AuthenticatorAction] authenticating admin succeeded
      10:42:17,268 ERROR [SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: Could not commit transaction
       at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:602)
       at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:330)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:231)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      .....
      Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1401)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
       at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
       at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
       at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:592)
      


      These exceptions are raised after a user successfully authenticates using:

      @Stateless
      @Name("authenticator")
      public class AuthenticatorAction implements Authenticator
      {
       @PersistenceContext
       private EntityManager em;
      
       @In
       Identity identity;
      
       @Out(required = false, scope = SESSION)
       private User user;
      
       @Logger
       Log log;
      
       public boolean authenticate()
       {
       log.info("authenticating #0", identity.getUsername());
      
       try
       {
       user = (User) em.createQuery("from User where username = :username")
       .setParameter("username", identity.getUsername())
       .getSingleResult();
      
       if (!user.getPassword().equals(Passwords.passwordDigest(identity.getPassword(), user.getSalt())))
       return false;
      
       if (user.getRole() != null)
       {
       identity.addRole(user.getRole());
       }
      
       log.info("authenticating #0 succeeded", identity.getUsername());
       return true;
       }
       catch (NoResultException e)
       {
       log.info("exception while authenticating #0", e, identity.getUsername());
       return false;
       }
       }
      }
      



      My Informix datasource file is:

      <datasources>
       <local-tx-datasource>
       <jndi-name>informixDatasource</jndi-name>
      
       <connection-url>jdbc:informix-sqli://hostname:1526/database:INFORMIXSERVER=iserver</connection-url>
       <driver-class>com.informix.jdbc.IfxDriver</driver-class>
       <user-name>username</user-name>
       <password>password</password>
      
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.InformixExceptionSorter
       </exception-sorter-class-name>
       <metadata>
       <type-mapping>InformixDB</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      and my persistence file is:

       <persistence-unit name="uvoltds">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/informixDatasource</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect"/>
      
       <property name="hibernate.hbm2ddl.auto" value="validate" />
       <property name="hibernate.show_sql" value="true" />
       <property name="hibernate.format_sql" value="true" />
       <property name="jboss.entity.manager.factory.jndi.name"
       value="java:/uvoltdsEntityManagerFactory" />
       </properties>
       </persistence-unit>
      


      I've tried unsuccessfully to find a clue via google. Can anyone point out the obvious or push me in the right direction?

      Thanks,
      Dan