Tuesday, May 15, 2012

JBoss AS 7 and PostgreSQL

So, I'm having some fun migrating a major project to EE6. I've been playing around with Glassfish 3.1.2, but now I'm evaluating JBoss AS 7.1.1.

First of all, I tried to use hibernate 4.1.1 bundled with my WAR file, but this caused this exception:

Caused by: java.lang.ClassCastException: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider
 at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:187)

I haven't yet found a way to resolve this, so for then I just went on using hibernate 4.0.1 in the AS. I guess it's mainly because the persistence unit in my application is loaded with the 4.1.1 jars, but the persistence unit, as it is deployed in the AS (not inside the WAR), is loaded by the 4.0.1 version. I'll give updates on this.

So when staying with 4.0.1, everything deployed fine, but when performing an operation, I got this:
Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
 at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:200)
 at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:172) 

Althought there's a hibernate.connection.autocommit setting that can be used in the persistence.xml, the problem was solved by enabling "Use JTA?" in the Datasource settings on the JBoss admin console.

No comments:

Post a Comment