Solved

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

Posted on 2003-10-24
3
825 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
ID: 9617750
You should probably also have the driver jar in WEB-INF/lib of your web app
0
 
LVL 1

Author Comment

by:tomerikv
ID: 9617866
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
ID: 9617882
Glad to hear it ;-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 56
How to convert String matching to regex in java 4 49
hibernate jars 4 45
maven not picking latest jar instead picking old jar from .m2 12 18
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

856 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