This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 48892 - Cannot use MySQL datastore under Tomcat
Summary: Cannot use MySQL datastore under Tomcat
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Sherold Dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-12 01:39 UTC by _ gtzabari
Modified: 2004-09-22 09:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2004-09-12 01:39:28 UTC
dev build 200409091800

I've placed the MySQL driver under C:\Program
Files\netbeans-4.0dev\nb4.0\jakarta-tomcat-5.0.28\common\lib
and I refer to MySQL as a datastore in my webapp
configuration file (web/meta-inf/context.xml) but
at runtime, I get the following exception from the
tomcat server:

Caused by:
org.apache.commons.dbcp.SQLNestedException: Cannot
load JDBC driver class 'com.mysql.jdbc.Driver'
	at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:766)
	at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at
net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
	at
net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
	... 36 more
Caused by: java.lang.ClassNotFoundException:
com.mysql.jdbc.Driver
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:854)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:721)
	at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:760)
	... 39 more

This used to work a few revision ago in Netbeans
and I have double checked my configuration and
this should be working. How does one get MySQL to
work as a datastore under the integrated Tomcat
server? This works fine in a standalone Tomcat
server I've got installed.
Comment 1 _ gtzabari 2004-09-12 06:34:47 UTC
Ok, this turned out to be a particularily evil bug in my code using
Hibernate. Sorry for yet another bad bug report :(

Before we close this issue though, can you please clarify if there is
a way to include the MySQL driver in a webapp-specific manner under
Netbeans instead of copying it into the common/lib directory?
Comment 2 Petr Jiricka 2004-09-13 09:54:00 UTC
Gili, when running the standalone Tomcat, do you run it using the
catalina.bat script or the catalina.50.bat ?  Thanks.
Comment 3 Petr Jiricka 2004-09-13 09:59:34 UTC
Sorry, I didn't readl last Gili's comment, disregard my previous
comment. Stepan, can you please verify what Gili is asking about?
Comment 4 Sherold Dev 2004-09-21 12:49:24 UTC
Closing as invalid.

You can add the mysql driver to your web application using the
"project properties/compiling sources" dialog.  This will put your
driver under the WEB-INF\lib directory of your web application.
Comment 5 _ gtzabari 2004-09-21 13:49:10 UTC
Sherold,

That won't work. Specifically, every time I place MySQL drivers in
web-inf/lib and try creating the datastore from within my webapp XML
configuration for Tomcat, it complains about not finding the driver.
If I place it in tomcat/common/lib it works.

Gili
Comment 6 Sherold Dev 2004-09-21 15:16:20 UTC
I'm sorry, I was wrong. According to Tomcat's documentation is putting
the driver into the $CATALINA_HOME/common/lib directory the only option.
Comment 7 _ gtzabari 2004-09-21 17:27:29 UTC
Sherold,

Thank you, now we know for sure. This does, however, bring up the
issue that users now have to dump JARs into the c:/program
files/netbeans-4.0/ directory. Is there a way to ameliorate the problem?
Comment 8 Sherold Dev 2004-09-22 08:45:59 UTC
Currently not. Feel free, however, to file an enhancement that IDE
should provide a support for this to easy this procedure.
Comment 9 Petr Jiricka 2004-09-22 08:51:45 UTC
Gili and Stepan,

maybe you want something like enhancement 49346 ?
Comment 10 Sherold Dev 2004-09-22 09:00:35 UTC
Yes, this might be a solution.