2 Replies Latest reply on Dec 17, 2005 6:51 PM by Steve Moyer

    Hibernate problems

    Steve Moyer Newbie

      I'm trying to use JBP2.2 (from HEAD) with PostgreSQL 8.0.3 on AS 4.0.3SP1 and I'm having a lot of problems getting the system to run.

      When Hibernate attempts to load the initial database, I'm getting a lot of exceptions like this:

      2005-12-06 17:20:04,298 INFO [STDOUT] known Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:428)
       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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
       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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
       at org.jboss.Main.boot(Main.java:187)
       at org.jboss.Main$1.run(Main.java:438)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
       at org.postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java:200)
       at org.postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java:187)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.setBlob(AbstractJdbc2Statement.java:2598)
       at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setBlob(WrappedPreparedStatement.java:468)
       at org.hibernate.type.BlobType.set(BlobType.java:49)
       at org.hibernate.type.BlobType.nullSafeSet(BlobType.java:117)
       at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1825)
       at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1802)
       at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2058)
       ... 138 more
      


      I tried adding this line to my hibernate.cfg.xml file (as well as manually setting the dialect):

      <property name="connection.autocommit">false</property>


      The property seems to load (the logs all say autocommit is false), but I'm still getting the error. Any ideas? I'm at the end of my rope.

        • 1. Re: Hibernate problems
          Steve Moyer Newbie

          Well ... I did a bunch more testing and have a bit of additional information. This problem seems to be related to Hibernate3's configuration when used with PostgreSQL 8.x. Here's a matrix of what does and doesn't work:

          JBoss AS 4.0.3SP1 was used as the application server in all cases.

          - Using JBP2.0, the same PostgreSQL datasource worked fine.

          - Using JBP2.2, using Hypersonic as the datasource worked fine.

          - Using JBP2.2, with PostgreSQL and a forced Hibernate dialect didn't load enough for the UI to work and produced a variety of exceptions (which seemed to be passed back up from the JDBC driver)

          - Using JBP2.2, with PostgreSQL, a forced Hibernate dialect and the connection.autocommit property added to the hibernate.cfg.xml files (the four in core), the system starts, the UI is usable, but the content that would have been loaded into the database is missing. The exceptions seem to be limited to "Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode." I haven't checked in the code yet, but I'm guessing it is assuming autocommit is on and each of the inserts which includes a blob is failing. Are all the SQL statement encapsulated in transactions? Once you start clicking in the UI you get a bunch of other exceptions since the content can't be found in the database.

          Is anyone using JBP2.2 with PostgreSQL 8? Is there something simple I'm missing? As you can see above, I've tried to discover what's happening but I'm still stuck with there being a configuration mismatch between Hibernate3 and PostgreSQL 8. Is this a valid assumption?

          A couple other observations that may help someone else out:

          - Really ugly things happen if you mismatch the JDBC driver with PostgreSQL. Version 7 drivers are NOT compatible with the version 8 database.

          - Really ugly things happen if you try to compile the project from a shared NFS drive ... the lack of locking (which can be disabled in Eclipse) causes files to appear to be missing. If you check the drive of the machine hosting the NFS volume, the files will generally be there (unless the locks caused the files to fail during creation.

          - Slightly less ugly things happen if you try to run the AS or its deploy directory from an NFS share. This is really bad because everything looks good, but there's still an occasional file missing. This took me quite a while.

          I'll be trying out a USB hard drive for my sandbox over the next two weeks, I'll let you know if the USBFS drivers cause similar problems.

          ciao, smoyer

          • 2. Re: Hibernate problems
            Steve Moyer Newbie

            As Roy Russo posted in this thread http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3913250#3913250, this problem has been fixed. See my comments there for any ramifications related to this thread.