2 Replies Latest reply on Feb 22, 2007 4:32 PM by James Hays

    JDBC error in Factory class

    blalls asdsd Novice

      Trying to execute a query in a Factory method I get this error:

      2006-08-30 11:59:27,495 DEBUG [org.hibernate.util.JDBCExceptionReporter] Cannot open connection [???]
      org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=sky/81, BranchQual=, localId=81]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=sky/81, BranchQual=, localId=81])
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
       at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
       at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
       at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
       at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
       at org.hibernate.loader.Loader.doQuery(Loader.java:661)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
       at org.hibernate.loader.Loader.doList(Loader.java:2145)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
       at org.hibernate.loader.Loader.list(Loader.java:2024)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:53)
       at ist.itl.services.RosterImpl.termFactory(RosterImpl.java:151)
      


      The method looks like:

       @Factory("terms")
       public void termFactory(){
       termId = 0;
       terms = entityManager.createQuery("from Term t where t.campus=:campus order by t.startDate desc")
       .setParameter("campus",sessionUser.getInstance().getCampus())
       .getResultList();
       }
      


        • 1. Re: JDBC error in Factory class
          Pete Muir Master

          It's likely there is another exception occuring earlier which is the root cause of the problem.

          • 2. Re: JDBC error in Factory class
            James Hays Novice

             

            "petemuir" wrote:
            It's likely there is another exception occuring earlier which is the root cause of the problem.


            What is the best way to help in determining this? I too have this issue quite frequently and am having limited success in tracking down the issues. Often times, I see this issue pop up after several queries have run, but it gets to a specific outjection that blows up. Is seam eating all of the exceptions? It appears that if something goes wrong in the application this GenericJDBC exception is thrown regardless of cause.