Solved

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

Posted on 2003-10-24
3
826 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example for saving data 19 73
jsp login check 12 52
How to determine if a string is a valid SHA value 7 43
Java Inheritance super keyword use 8 31
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

685 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