-->
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.  [ 4 posts ] 
Author Message
 Post subject: No TransactionManagerLookup specified error ----please help
PostPosted: Thu Jun 22, 2006 5:23 am 
Newbie

Joined: Thu Jun 22, 2006 5:09 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
hi all I am quite new to hibernate and I am trying to built a test web application which can add new item to the database.

Hibernate version:
I ma using Hibernate 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():
the following is the dbProc class where I place to code to save a new record. I believe I missed sth here so that it threw the 'No TransactionManagerLookup specified' exception.

package Server;

import org.hibernate.Session;
import org.hibernate.Transaction;
import OTPServer.HibernateUtil1;

public class dbProc {

/** Creates a new instance of dbProc */

public static void addUser(String userName, String passWord)
{
Transaction tx;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
tx=session.beginTransaction();
userAuth user = new userAuth();
user.setId(userName);
user.setPassCode(passWord);
session.save(user);
tx.commit();
HibernateUtil.getSessionFactory().close();
}
}


Full stack trace of any exception that occurs:
org.hibernate.HibernateException: No TransactionManagerLookup specified
org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:503)
OTPServer.dbProc.addUser(dbProc.java:26)
OTPServer.useraddAdmin.processRequest(useraddAdmin.java:49)
OTPServer.useraddAdmin.doGet(useraddAdmin.java:67)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)



Name and version of the database you are using:
I am using HypersonicSQL

thank you very much!
regards
Jason


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 11:56 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You must be using an application server's connection provider, I take it? You have to configuration the hibernate.transaction.manager_lookup_class property (in your hibernate.cfg.xml or hibernate.properties file). Have a look in org/hibernate/transaction, they're all in there. Choose the one for the transaction manager you're using.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 8:53 am 
Newbie

Joined: Thu Jun 22, 2006 5:09 am
Posts: 2
hi thanks for your kind reply,

yes, I am using the bundled HpersonicSql db from Jboss, but I didn't use the jboss Application server, I am using tomcat to contain my web application.

actually I am using the hibernate plugin for Netbeans (My IDE), I configured the hibernate properties when I created the hibernate bean. I just took it that hibernate would take care the transaction and connection with DB.

I did try what you suggested. following is my hibernate configuration file:

<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:g:\\temp\\experian\\temp\\DB.data</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup.class</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">3</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="OTPServer/userAuth.hbm.xml"/>
</session-factory>
</hibernate-configuration>

I also tried org.hibernate.transaction.TransactionManagerLookup.class

when I redeployed and run the application, hibernate threw another exception:

Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not instantiate TransactionManagerLookup


thanks, regards

Jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 8:59 am 
Beginner
Beginner

Joined: Wed Jun 21, 2006 10:08 am
Posts: 26
I am sorta in the same boat as you are.

I am not running an app server like JBoss, and just have Tomcat running as a WTP in Eclipse.

Since I want to use optimized locking with my level 2 caching (JBoss Tree Cache), it needs a manager_lookup_class.

From my understanding, to get this to work properly you will have to write your own manager_lookup_class. I haven't dug deeply into it yet, but I believe you just implement a :TransactionManagerLookup.

if you look at the javadocs: http://docs.jboss.org/jbossas/javadoc/3 ... ookup.html

you might get a better understanding. Please let me know if you come across anything as well.

Thanks.

_________________
- Jonathan


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