views:

43

answers:

3

Hi Guys,

I am getting this exception in my java project

Caused by: java.lang.ClassNotFoundException: org.apache.axiom.om.OMDataSource
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

My classpath is

C:\axiom-impl-1.2.7.jar;C:\axiom-api-1.2.7.jar;C:\axiom-dom-1.2.7.jar;.;

Can you please help me out ?

A: 

Get the jar and try re installing it.

org.life.java
I have run this code from eclipse and it worked fine.When i run it from command line i get this exception
mujeeb
from command line means? what is the project structure, it seems that eclipse takes care of classpath and when you run it from command line , classpath is not taken care of
org.life.java
I have kept the classpath as C:\axiom-impl-1.2.7.jar;C:\axiom-api-1.2.7.jar;C:\axiom-dom-1.2.7.jar;.;The required class in these jars.I have place all the required jars in the same folder are the jar which I am running using java -jar command. And also the 3 jars in the classpath are in c drive
mujeeb
Environment variable CLASSPATH is defined properly?
Ido
In System VariableVariable name is CLASSPATHVariable value is C:\axiom-impl-1.2.7.jar;C:\axiom-api-1.2.7.jar;C:\axiom-dom-1.2.7.jar;.;
mujeeb
have you restart your command prompt after setting up the classpath ?
org.life.java
or try running C:> java -classpath C:\YOUR_JAR.jar;C:\YOUR_JAR2..
org.life.java
Thanks for your replies.... Yes i have tried both.I was getting the same error on eclipse as well till i added all the jars in the axis lib directory to the classpath.
mujeeb
So is it solved or not? if so you can always upvote :)
org.life.java
Unfortunately no. Not yet :).This is turning out to be very wierd.Just got the latest axiom jar and tried with that too.... still the same bug
mujeeb
I removed the axiom-api-1.2.7.jar from the classpath in eclipse and i get this same exception.the exception goes away when i add it back.Definately the prob is with the axiom-api-1.2.7.jar
mujeeb
When you add if exception goes away then the problem is not with the jar. it should stay there.
org.life.java
what i meant to say was, the problem is definately with the classpath and the axiom jar is not in the classpath.
mujeeb
btw mine is a webservice application. From what i understand all the dependent jars are to be in the classpath. I got the complete list of jars in axis2_home/lib using a java code that i wrote. Then ran this command java -classpath TheCompleteListOfJarsInAxis2_home -jar jarname.jar............... Still getting the same exception
mujeeb
A: 

Set the environment variable CLASSPATH to include the path's to the jar. or use java -classpath <...>

Ido
C:\Documents and Settings\mujeeb\Desktop\CredChangeReportSVC_1.0\release>java -classpath C:\axiom-dom-1.2.7.jar -jar credchangereportsvc-1.0.jarand did the same with the other 2 jarsnot luck.... getting the same errorTried this tooC:\Documents and Settings\mujeeb\Desktop\CredChangeReportSVC_1.0\release>java -classpath C:\axiom-impl-1.2.7.jar;C:\axiom-api-1.2.7.jar;C:\axiom-dom-1.2.7.jar;.; -jar credchangereportsvc-1.0.jar
mujeeb
A: 

Hi Guys, Finally managed to resolve this issue. The problem was that the jar had a manifest.mf file inside it which defined the classpath. I guess this takes priority over any env variable of the -classpath option in the java command in command prompt.

This is my manifest.mf file after changes Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.1 Created-By: 1.6.0_20-b02 (Sun Microsystems Inc.) Built-By: Arcot Main-Class: com.arcot.csso.credchangereportsvc.CredChangeReportSVC Version: 1.0 Class-Path: lib/classes lib/TPFService-XBeans-packaged.jar lib/TPFServ ice-client.jar lib/aspectjrt.jar lib/axis2-kernel-1.4.1.jar lib/commo ns-lang-2.5.jar lib/log4j-1.2.16.jar lib/ojdbc14-10.2.0.1.0.jar lib/x mlbeans-2.4.0.jar ./conf/ lib/axiom-api-1.2.7.jar lib/wsdl4j-1.6.2.jar lib/XmlSchema-1.4.2.jar lib/commons-logging-1.1.1.jar lib/commons-httpclient-3.1.jar lib/axiom-impl-1.2.7.jar lib/backport-util-concurrent-3.1.jar lib/neethi-2.0.4.jar lib/commons-codec-1.3.jar

mujeeb