-->
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.  [ 8 posts ] 
Author Message
 Post subject: Really unable to configure hibernate with tomcat and JNDI
PostPosted: Sun Aug 21, 2005 10:46 am 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
Hi everybody

I'm sorry to ask this question but it's now 2 days I'm fighting to get JNDI provided by Tomcat and hibernate working together.

First I create a JNDI Context with tomcat in my context
Code:
<Resource name="jdbc/crm"
auth="Container"                                              type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
user="root"
password="457yuuio"
driverClassName="org.gjt.mm.mysql.Driver"
url="jdbc:mysql://localhost/crm?user=root&amp;password=457yuuio"
maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="3"
logAbandoned="false"/>


This work fine when I use a code like this one

Code:
Context ctx = new InitialContext();
if(ctx == null ) throw new Exception("Boom - No Context");
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/crm");


Now here is the part of my hibernate.cfg.xml to work with JNDI

Code:
<property name="connection.datasource">java:comp/env/jdbc/crm</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>



But When I try to get the SessionFactory Using this code

Code:
sessionFactory = configuration.configure().buildSessionFactory();


I got this error

Code:
Building SessionFactory failed :
NoClassDefException : javax/transaction/Synchronization


I really don't know what to do for this

Any help would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 1:16 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
put jta.jar in the classpath .


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 1:49 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
Thank you very much !!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 1:57 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
You forgot to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 5:07 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
dennisbyrne wrote:
Thank you very much !!!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 5:09 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
I'm sorry i mistake rating and quoting, honnestly if knew how to rate you I give you a very good one.

But I really don't know.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 6:22 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
If you are logged in, there will be a message at the end of other user's posts reading "Please rate this answer to give credits to the poster! Did it solve the problem".


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 2:48 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 6:15 pm
Posts: 28
Yes, I didn't notice it, it's done now.


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