5 Replies Latest reply on Apr 3, 2006 3:49 PM by secret too

    Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1.1

    varkon Newbie

      I have recently upgraded my JBoss install (4.0.3-sp1) to use Hibernate 3.1.1 (from version H3.1). However I've started getting strange problems. Namely I've been receiving the following error:

      TransactionRolledbackException in method: public abstract boolean gr.logismos.wms.interfaces.ControlWmsRemote.Connect(java.lang.String,java.lang.String) throws gr.logismos.wms.support.Exceptions.UserNotFoundException,gr.logismos.wms.support.Exceptions.InvalidPasswordException,gr.logismos.wms.support.Exceptions.DataBaseException,gr.logismos.wms.support.Exceptions.InvalidConfigurationException,gr.logismos.wms.support.Exceptions.NoCorrectUserConfigurationException,java.rmi.RemoteException, causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=calypso/15, BranchQual=, localId=15] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.SessionException: Session is closed!)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:354)
       at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:486)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:346)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
       at org.jboss.ejb.Container.invoke(Container.java:873)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
       at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
       at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
       at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
       at $Proxy84.Connect(Unknown Source)
       at gr.logismos.wms.web.Controller.Login.ProccessRequest(Login.java:93)
       at gr.logismos.wms.web.Controller.FrontServlet.doProcess(FrontServlet.java:182)
       at gr.logismos.wms.web.Controller.FrontServlet.doPost(FrontServlet.java:156)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.hibernate.SessionException: Session is closed!
       at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:50)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:352)
       at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1473)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1092)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:306)
       ... 50 more
      


      ...and my application breaks. Another peculiarity is that I do not execute any insert or update (in SQL or Hibernate) and the error message mentions something about a "commit".

      Database is Oracle9i and I use the required dialect in Hibernate.

      If I go back to version 3.1 everything works fine. I'd appreciate any help.

        • 1. Re: Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1
          Priit Parmann Newbie

          I have encountered the same kind of problem with JBoss4.0.3SP2, when I replaced hibernate3.jar in the lib folder with the newer one. DB is Oracle 10g. So maybe it doesn't work that way..

          The reason, why I'm trying this at all, is that we have very serious problem with the combination of JBoss+Hibernate+Oracle - trying to persist an Object (that might contain a Blob) looks fine, until I check the DB and see that it isn't actually written to the DB. There are no Exceptions or Throwables thrown - hibernate just don't insert these records to DB. If I call session.flush() before committing the transaction, everything seems to work, BUT I can only insert couple of records to the DB and after that the DB connection starts to block indefinitely. It just hangs there, Oracle tools show that some kind of transaction is in a WAIT state and it won't complete (I let it be this way for the entire weekend, but nothing changed and only kill -9 [jboss PID] helped).

          We have tried different drivers (oci, thin) and several versions of the drivers, jboss, hibernate, changing various hibernate properties, but nothing seems to work. The records won't either show up in the DB or the application will hang at some point :(

          I've searched hibernate and jboss forums for days, but saw only couple of the same kind of problems out there and never found a solution to my problem. A forum thread with a similar problem - http://forum.hibernate.org/viewtopic.php?t=932154&highlight=flush

          PS! Sorry for hijacking the thread, maybe I should create a new one...

          • 2. Re: Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1
            Priit Parmann Newbie

             

            "parmaley" wrote:
            I have encountered the same kind of problem with JBoss4.0.3SP2, when I replaced hibernate3.jar in the lib folder with the newer one. DB is Oracle 10g. So maybe it doesn't work that way..

            The reason, why I'm trying this at all, is that we have very serious problem with the combination of JBoss+Hibernate+Oracle - trying to persist an Object (that might contain a Blob) looks fine, until I check the DB and see that it isn't actually written to the DB.

            .....


            We managed to solve the problem by not using JBoss' Hibernate session management or HAR deployer. We created hibernate.cfg.xml file and put it in our application's jar file and configure Hibernate SessionFactory from that file during runtime. We also updated hibernate jar files in the lib directory (hibernate3.jar, hibernate-annotations.jar, hibernate-entitymanager.jar) and added ehcache-1.1.jar from hibernate3.1.1 to classpath. Now the application doesn't lock up anymore and data is commited to the DB as well (by using session.flush() ). Hope it helps someone :-)

            • 3. Re: Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1
              secret too Newbie

              parmaley,

              How did you not use Jboss's hibernate deployer? I have the same problem you have and would like to not use JBoss's har deployer, but I am not sure how to do that. Please post how you configured Jboss to not use the .har deployer and how you configured your hibernate session,etc. I've been searching for days trying to find a solution to my problem, but without success. I would really really appreciate your help. BTW, my problem is that .har deployer doesn't recognize annotatated pojos, so it throws
              " Association references unmapped class" exception.

              thanks so much!!

              • 4. Re: Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1
                belasco99 Newbie

                I would love to see the non-jboss-deployed hibernate config as well

                thanks

                • 5. Re: Problem after upgrading JBoss 4.0.3-sp1 to Hibernate 3.1
                  secret too Newbie

                  This information is well hidden and after much research, I finally figured it out. Basically, the steps are:

                  1. create a jar file containing your pojos, .hbm files and hibernate.cfg.xml. Make sure you name it with .jar extension, not .har.

                  2. remove jboss har deployer by deleting the har deployer directory from /deploy directory

                  3. manually upload hibernate class and mapping files. If you are using the annotation configuration, it would look something like this:

                  AnnotationConfiguration cfg = new AnnotationConfiguration();

                  cfg.configure();
                  sessionFactory = cfg.buildSessionFactory();

                  The reason why we couldn't use har deployer was because jboss 4.0.3 couldn't handle annotated pojos. Hibernate 3.1 can handel it, but Jboss 4 comes with Hibernate 3.0, which can't handle annotated pojos. Hope this helps.