Solved

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

Posted on 2003-10-24
3
828 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

737 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