Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help! JSP w/ struts can't find Class.forName("com.mysql.jdbc.Driver")

843840Apr 24 2008 — edited Apr 24 2008
I think this is just a directory structure issue but I can't figure it out. I am writing a JSP / Struts / MYSQL web application which uses the mysql JDBC connector. The connector (mysql-connector-java-5.1.6-bin.jar) is in the referenced libraries. If I write the line of code:

Class.forName("com.mysql.jdbc.Driver");

To load up the driver, it works in JSP files in the folder /projectname/webroot/web-inf just fine and I can go on to execute MySQL queries. However, I need to load up the driver in an action (.java action) with the directory structure /projectname/src/action and it throws the exception "class not found", I believe, it can no longer seem to get to the driver. Can anyone tell me how to resolve this problem?

Thanks in advance, I hope this is the correct place (I have done my best to find the right one).

Edited by: Arkanin on Apr 24, 2008 4:39 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2008
Added on Apr 24 2008
3 comments
213 views