-->
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.  [ 3 posts ] 
Author Message
 Post subject: Could not locate TransactionManager
PostPosted: Thu Feb 16, 2006 6:38 am 
Newbie

Joined: Thu Feb 16, 2006 6:21 am
Posts: 2
Hi all,
I am new to Hibernate. Please help me with this exception.

My hibernate.cfg.xml is :

<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@192.168.0.2:1521:TPSS10G</property>
<property name="connection.username">gps</property>
<property name="connection.password">gps</property>

<property name="dialect">org.hibernate.dialect.OracleDialect</property>

<!-- only set to true for debug - PLEASE don't check this in set to true -->
<property name="show_sql">false</property>

<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>

<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.transaction.auto_close_session">true</property>

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


And my code is

try {
// Create the SessionFactory from hibernate.cfg.xml
System.out.println("Creating Configuration.");
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed. " + ex);
throw new ExceptionInInitializerError(ex);
}

And when I execute it, the following xception is throw at the above line :

Initial SessionFactory creation failed. org.hibernate.HibernateException: Could not locate TransactionManager
java.lang.ExceptionInInitializerError
at util.HibernateUtil.<clinit>(Unknown Source)
at events.EventManager.createAndStoreEvent(Unknown Source)
at events.EventManager.main(Unknown Source)
Caused by: org.hibernate.HibernateException: Could not locate TransactionManager
at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:26)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:268)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
... 3 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
... 5 more
Exception in thread "main"


Please help me with what input to be specified and in which file.

Waiting for the reply.

-Srik


Top
 Profile  
 
 Post subject: in container or out
PostPosted: Thu Feb 16, 2006 3:37 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
If you run it is outside of WebLogic container than it will not work.

Remove the following lines and it should resolve the issue:
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>


http://www.hibernate.org/hib_docs/v3/re ... ation.html

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Re: in container or out
PostPosted: Fri Feb 17, 2006 3:25 am 
Newbie

Joined: Thu Feb 16, 2006 6:21 am
Posts: 2
Thanks. I've now resolved the issue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.