1

I have a webservice client created using cxf. When I run from eclipse I dont get any errors. But when I create a jar out of the files and run it from cmd prompt , I get NoclassDef exception or ClassNot found exception. I have set the classpath, java home correct.

1. Exception

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

2. Exception

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cxf/databinding/DataBinding
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.databinding.DataBinding
        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)

The web service is in C# wcf and the client was created without JAXBinding element. Anyhelp will be appreciated.

Thanks, Priya.R

3
  • the ClassNotFound exception will have the name of the class as well. Can you please specify that as well. Commented Nov 8, 2010 at 6:27
  • Thanks Feroz. i have added that as well. Commented Nov 8, 2010 at 6:49
  • sounds like you are missing the jaxb jar. Which java version you are using? Commented Nov 8, 2010 at 7:20

1 Answer 1

1

This is a typically and easiy-to-solve classpath problem: The cxf library (-ies) is/are missing on the classpath. Start the application like this:

java -cp <youJar.jar>;<cxf.jar>[;<another-cxf.jar>;...] my.pkg.Application

You'll have to replace the name of the main class and the values of the -cp parameter with the paths and names of your jar and all other libraries that are required to run the application.

Why does it work from eclipse: In eclipse, you've set the build path correctly, but this builds path is not exported or added to the jar.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.