java.lang.NoClassDefFoundError: javax/xml/rpc/Service

Hi,

I have created client stubs for a webservice using axis wsdl2java tool. When I try calling these stubbed methods from JUnit tests, they are working fine but when I try to execute the jar (it is a swing) I get the following exception:

Exception in thread"main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

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)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

at com.Gudds.SeCURE.MainUI.<init>(MainUI.java:76)

at com.Gudds.SeCURE.Main.Start(Main.java:62)

at org.owasp.webscarab.WebScarab.main(WebScarab.java:34)

I have put the jaxrpc.jar in the classpath and I suppose this jar has the java.xml.rpc.service class but I donot understand why it fails while executing the jar but works fine from the eclipse IDe. Plase help me.

Regrdas,

Kundan

[1522 byte] By [Kundana] at [2007-10-3 8:45:21]
# 1
I have the excactly same problem when using jBuilder...Please send any info on solution to bjorn._.sigurd._.johansen@@@@spidersolutions._.no (Please remove 3 "@" and double dots and underscores in email adress)Best regards,Bjorn Sigurd
BjornSigurda at 2007-7-15 3:54:14 > top of Java-index,Desktop,Deploying...
# 2

I was having a similar problem, my program ran fine in Eclipse IDE, but when I tried to run it as a jar file it gave me a NoClassDefFoundError for a class in a jar file that was in the classpath. I'm still not exactly sure what causes this problem to happen occasionally, but I was able to work around my problem by exporting the project to a single jar file using the Eclipse Fat Jar Plug-in. I'm still hoping someone with a bit more experience can come up with a better solution though.

Phyngea at 2007-7-15 3:54:14 > top of Java-index,Desktop,Deploying...
# 3

1. Build jar file with MAINFEST.MF and Export of Eclipse , which has content:

suppose in folder:

c:\client.jar ( client of web service )

c:\contrib/lib/ axis apis

Main-Class: com.MainClassName

Class-Path: contrib\axis\jaxrpc.jar contrib\axis\activation.jar con

trib\axis\axis.jar contrib\axis\axis.jar contrib\axis\commons-disco

very.jar contrib\axis\wsdl4j.jar contrib\axis\saaj.jar contrib\axi

s\soap.jar contrib\axis\commons-logging.jar contrib\axis\log4j.jar

contrib\axis\mail.jar

2. build jar with ant: make sure the their are at least one blank between

values of Class-Path.

<jar destfile="../Client/client.jar" >

<fileset dir="${build.dir}"/>

<manifest>

<attribute name="Built-By" value="${user.name}"/>

<attribute name="Main-Class" value="com.MainClass"/>

<attribute name="Class-Path" value=" contrib\axis\jaxrpc.jar contrib\axis\activation.jar .. "/>

</manifest>

</jar>

3. If you haven't pack you class file in jar, create a bat to set CLASSPATH

exactly to all jars.

Hope this helps

TinySofta at 2007-7-15 3:54:14 > top of Java-index,Desktop,Deploying...