-->
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.  [ 6 posts ] 
Author Message
 Post subject: database driver in webapplication
PostPosted: Mon Jan 23, 2006 4:03 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 12:35 pm
Posts: 21
Hi,

I am using Hibernate in a Struts based webapplication. I've created all the mappings, and when I try to use Hibernate in a normal Java program, it works great.

Now I'm trying to use the hibernate capabilities in my web application, but each time a get an error. I went looking in the error log of my server, and there it says that it cant found my jdbc Driver class.

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I am using eclipse, and imported the .jar file of my database connector as an external jar file. As mentioned above, this works in a normal java program. Why doesnt this work in a webapplication ? Doesn 't the external jar file get deployed or something ? I must say, I'm not much of a java build path guru, so i guess it has to do something with that.

Any suggestions ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 11:15 pm 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
put the driver jar file in your web container's libraries folder and restart the container.
for eg: in case of tomcat it may be TOMCATDIR/commons/lib

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 3:39 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
It's usually a bad idea to add anything to the web container COMMON library directory (mostly to avoid version conflicts).

Use the web application's own library directory instead, unless the common directory is needed to make the web container's connection pooling mechanism pick up the driver (which may well be the case).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 4:31 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
thanks jwenting for the info .

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 4:58 am 
Beginner
Beginner

Joined: Thu Oct 20, 2005 12:35 pm
Posts: 21
allright ! thx

Apparently externally imported jar files in eclipse dont get deployed when using the eclipse deploy options. Stupid eclipse.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 7:31 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
That does sound logical. Eclipse likely assumes those jars are not to be deployed else they'd have been made part of the project.

This could for example be j2ee.jar which in a webapp would be provided internally by the application server, or junit which doesn't need to be deployed with the application because the testcases aren't supposed to be run after deployment.


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