Solved

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver occurs only when I use AXIS web services, not else!!

Posted on 2003-10-24
3
821 Views
Last Modified: 2013-11-24
Hello!

I've written a Java program that connects to MySQL.
This works fine.

But when I try to use the same Java-file as a .jws file (as a web service on TomCat/AXIS), I get the error(this is pasted from the tomcat cmd-prompt window):

my comment: connect2db failed
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.lang.ClassLoader.findClass(ClassLoader.java:341)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at DAC_v1.connect2db(DAC_v1.java:71)
        at DAC_v1.readData(DAC_v1.java:18)
        at DAC_v1.select(DAC_v1.java:225)
        at DAC_v1.chooseOperation(DAC_v1.java:260)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethod
java:39)

It is the same file, and this doesn't happen when I run it as a regular java file.
So as a java-file it connects to MySQL, but when used under AXIS it don't.

I use a MySQL ODBC 3.51, but this is a "User DSN" ODBC, not "System DSN".
The portnumber is default: 3306
My tomcat web server uses port standard 8080.

Could this be the problem?

The problem is also that I can't use the MySQL ODBC as System DSN beacuse I can't find it on the list of availabe ODBC types under "System DSN".

Or is the problem something else?
My classpath is:

.;%SAG_COMMON%\xts.jar;E:
\Program Files\Common Files\Software AG\sagxds.jar;
%SAG_COMMON%\saglic.jar;%SAG_COMMON%\sagxds.jar;E:
\mysql_win2000_jconnect\mysql-connector-java-3.0.9-stable\mysql-connector-java-3.0.9-stable-bin.jar;E:
\tomcat\jtcv2\bin\tomcat-jni.jar;E:\tomcat\jtcv2\common\lib\ant.jar;E:
\tomcat\jtcv2\server\lib\catalina.jar;E:
\tomcat\jtcv2\server\lib\catalina-ant.jar;E:
\tomcat\jtcv2\server\lib\servlets-common.jar;E:
\tomcat\jtcv2\server\lib\tomcat-jk.jar;E:
\tomcat\jtcv2\server\lib\tomcat-jk2.jar;E:
\tomcat\jtcv2\server\lib\tomcat-util.jar;E:
\tomcat\jtcv2\server\webapps\admin\WEB-INF\lib\struts.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\jaxrpc.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\axis.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\commons-logging.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\log4j-1.2.4.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\wsdl4j.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\xml-apis.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\xmlParserAPIs.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\xercesImpl.jar;E:
\tomcat\jtcv2\webapps\axis\WEB-INF\lib\xercesSamples.jar;E:
\AxisBeta322okt2003\axis-1_0\webapps\axis\WEB-INF\lib\jaxrpc.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\axis.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\commons-logging.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\log4j-1.2.4.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\saaj.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\tt-bytecode.jar;E:
\AxisBeta322okt2003\axis-1_0\lib\wsdl4j.jar;E:
\j2sdk1.4.2_02\lib\tools.jar

I'd appretiate any help veery much!!

Thanks in advance!

Regards,
Tom-Erik
0
Comment
Question by:tomerikv
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
Comment Utility
You should probably also have the driver jar in WEB-INF/lib of your web app
0
 
LVL 1

Author Comment

by:tomerikv
Comment Utility
Hi again!

Now it works!!! Thanks a lot, again!

before it was:
the result name is: 0

Now it is:
the result name is: Tom-Erik Valso

You've made my day! : )

Kind regards,
Tom-Erik
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Glad to hear it ;-)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now