-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: hibernate JTA transaction: Failed to instantiate Transaction
PostPosted: Wed Apr 13, 2005 2:47 am 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
Hibernate version:2.0

Mapping documents:hibernate.cgf.xml
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransaction</property>
<property name="connection.username">username</property>
<property name="connection.url">jdbc : oracle : thin: @ ip : port : sid</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>


Name and version of the database you are using:
oracle 9i

There is this error:
06:09:43,984 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransaction
06:09:44,000 ERROR [TransactionFactoryFactory] Failed to instantiate TransactionFactory
java.lang.InstantiationException: net.sf.hibernate.transaction.JTATransaction

Quite confused what happens, and how to heal it?

Thanks!


Paul


Top
 Profile  
 
 Post subject: Re: hibernate JTA transaction: Failed to instantiate Transac
PostPosted: Wed Apr 13, 2005 4:18 pm 
Regular
Regular

Joined: Tue Jan 11, 2005 8:55 pm
Posts: 53
paulur wrote:
Hibernate version:2.0

Mapping documents:hibernate.cgf.xml
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransaction</property>
<property name="connection.username">username</property>
<property name="connection.url">jdbc : oracle : thin: @ ip : port : sid</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>


Name and version of the database you are using:
oracle 9i

There is this error:
06:09:43,984 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransaction
06:09:44,000 ERROR [TransactionFactoryFactory] Failed to instantiate TransactionFactory
java.lang.InstantiationException: net.sf.hibernate.transaction.JTATransaction

Quite confused what happens, and how to heal it?

Thanks!


Paul


You need to specify the "transaction manager look up class" property in your cfg.xml file. For example, if you are using Weblogic, it would be:

Code:
          <property name="transaction.manager_lookup_class">
               net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
          </property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 8:03 pm 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
hamids,

Thank you so much for your message!

now I add the TranactionManagers, and the hibernate.cfg.xml looks as following:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">username</property>
<property name="connection.url">jdbc:oracle:thin:@ipaddress : port : sid </property>
<property name="connection.password">password</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>

<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</property>

<mapping resource="hibernate/Role.hbm.xml" />
</session-factory>
</hibernate-configuration>

Now a new error as following:
00:00:51,046 INFO [Environment] Hibernate 2.1.6
00:00:51,046 INFO [Environment] hibernate.properties not found
00:00:51,062 INFO [Environment] using CGLIB reflection optimizer
00:00:51,062 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
00:00:51,062 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
00:00:51,734 INFO [Configuration] Mapping resource: hibernate/Role.hbm.xml
00:00:51,984 INFO [Binder] Mapping class: com.eplus.healthe.hibernate.Role -> ROLES
00:00:52,109 INFO [Configuration] Configured SessionFactory: null
00:00:52,109 INFO [Configuration] processing one-to-many association mappings
00:00:52,109 INFO [Configuration] processing one-to-one association property references
00:00:52,109 INFO [Configuration] processing foreign key constraints
00:00:52,140 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
00:00:52,156 INFO [SettingsFactory] Use outer join fetching: true
00:00:52,156 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
00:00:52,156 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
00:00:52,265 INFO [DriverManagerConnectionProvider] using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@10.0.1.210:1521:UTF8
00:00:52,265 INFO [DriverManagerConnectionProvider] connection properties: {user=HEALTHE_ADMIN2, password=password}
00:00:52,265 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
00:00:52,937 INFO [SettingsFactory] Use scrollable result sets: true
00:00:52,937 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
00:00:52,937 INFO [SettingsFactory] Optimize cache for minimal puts: false
00:00:52,937 INFO [SettingsFactory] Query language substitutions: {}
00:00:52,937 INFO [SettingsFactory] cache provider: net.sf.hibernate.cache.EhCacheProvider
00:00:52,937 INFO [Configuration] instantiating and configuring caches
00:00:53,125 INFO [SessionFactoryImpl] building session factory
00:00:53,609 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured

I'm looking forawrd to hearing from you!

Regards,
Paul


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 2:07 pm 
Regular
Regular

Joined: Tue Jan 11, 2005 8:55 pm
Posts: 53
Search the forum, there are *many* posts on this issue. If you are using an app server, in your case Weblogic, here are the basic steps:

1. Specify a datasource in Weblogic, via the admin console.
2. Tell hibernate where the datasource is (via your hibernate.cfg.xml) file.
3. Specify the transaction manager lookup class.

Because I'm a nice guy, here is what your cfg xml should look like:

Code:
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
   <session-factory>

      <!-- JNDI DataSource Connection -->
          <property name="connection.datasource">myDataSource</property>
          

      <!-- Transaction Management Properties-->
          <property name="transaction.manager_lookup_class">
               net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
          </property>

          <property name="transaction.factory_class">
               net.sf.hibernate.transaction.JTATransactionFactory
          </property>
   
       <!-- Miscellaneous Properties -->
          <property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>

   
      <!-- mapping files -->
      <mapping resource="Sample1.hbm.xml"/>
     </session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 7:30 pm 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
hi hamids,

thanks for the message. Just wondering whether there is any way that I don't need app server when using hibernate objects.

Also, is it posssible to use a standalone application to invoke hibernate objects?


Regards,
Paul


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 9:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I really suggest you start here:

http://www.hibernate.org/5.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 9:56 pm 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
steve,

You'll be really appreciated if you can answer me with a clear decision like "yes" or "no" to the quest "is it posssible to use a standalone application to invoke hibernate objects". because I jsut couldn't find a good way to test hibernate objects.

Regards,
Paul


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 12:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
yes

http://www.hibernate.org/5.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 12:24 am 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
That's really nice...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 16, 2005 5:45 am 
Newbie

Joined: Wed Apr 13, 2005 2:43 am
Posts: 9
after reading those badly organized documemnts, i'm still quite confuse how a standalone java application can invoke a serverside hibernate objects....

do they have JNDI names?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.