1 Reply Latest reply on Jun 11, 2009 1:40 PM by Frank Langelage

    Oracle 10g with Jboss 4.2.3 Entity Manager / Hibernate

    Alexander Hartner Expert

      My application uses 3 different datasources all going to the same database. One with XA support is used via the JNDI name by the entity manager configured in persistence.xml. The other two are no-tx-datasources.

      I am able to access certain aspects using the datasources however as soon as I try to make a change via entity manager I get the error shown below.

      Any suggestions on what I am doing wrong. The same application works fine using SQL Server 2005.


      4:47:40,170 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      4:47:40,170 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      4:47:40,342 INFO [SettingsFactory] RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
      ith the Partitioning, OLAP, Data Mining and Real Application Testing options
      4:47:40,342 INFO [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 10.2.0.4.0
      4:47:40,389 INFO [Dialect] Using dialect: org.hibernate.dialect.Oracle10gDialect
      4:47:40,404 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
      4:47:40,404 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
      4:47:40,420 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup


      and then later

      14:47:48,920 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
      14:47:48,951 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 1m:4s:969ms
      14:48:03,342 WARN [PageNotFound] No mapping for [/diagnostics/spring/j_security_check] in DispatcherServlet with name 'thunderhead'
      14:48:35,092 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      14:48:35,092 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fdd7:cf6:4a155b48:d1 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fdd7
      :cf6:4a155b48:d1 status: ActionStatus.ABORT_ONLY >)
      14:48:35,092 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.exception.GenericJDBCException: Cannot open connection
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
      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:1547)
      at org.hibernate.loader.Loader.doQuery(Loader.java:673)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)


        • 1. Re: Oracle 10g with Jboss 4.2.3 Entity Manager / Hibernate
          Frank Langelage Master

          XA-connections seem to be very complicated. It took us some time to find the right settings.
          What's the content of XA-Datasource description?
          Ours is

          <?xml version="1.0" encoding="UTF-8"?>
          <datasources>
           <xa-datasource>
           <jndi-name>ora-11g</jndi-name>
           <track-connection-by-tx/>
           <isSameRM-override-value>false</isSameRM-override-value>
           <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
           <xa-datasource-property name="URL">jdbc:oracle:thin:@sb2000:1521:11g</xa-datasource-property>
           <xa-datasource-property name="User">lafr</xa-datasource-property>
           <xa-datasource-property name="Password">...</xa-datasource-property>
           <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
           <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
           <prepared-statement-cache-size>100</prepared-statement-cache-size>
           <metadata>
           <type-mapping>Oracle9i</type-mapping>
           </metadata>
           </xa-datasource>
          </datasources>