3

This error : java.lang.ClassNotFoundException : javax.xml.soap.SoapException

I can see javax.xml.soap.SoapException is on the classpath so what could be causing this error ?

In more general terms how could a java.lang.ClassNotFoundException be thrown in running code, should the compiler not catch this error ? The only situation I could this occurring is that if a jar was built using a library and the library that jar depends on is not on the classpath when using the jar.

5
  • 1
    Is it really looking for javax.xml.soap.soapexception? Because that class doesn't exist. javax.xml.soap.SoapException, does exist, however. Commented Nov 4, 2013 at 23:01
  • It means the class is not found. It may be that the class exists somewhere in the execution environment, but not in the classpath that was being accessed at the time of the error. Commented Nov 4, 2013 at 23:02
  • If a component of the app attempts to use a custom class loader to load a class and the class is not found in that loader's path you can get this error, even if the class is in the main classpath. Commented Nov 4, 2013 at 23:05
  • 1
    @rmlan it should be javax.xml.soap.SOAPException Commented Nov 4, 2013 at 23:10
  • It's definitely SOAPException for Java. .NET has a class called SoapException - maybe that's where the confusion has come from. Commented Nov 4, 2013 at 23:27

2 Answers 2

1

The classpath you use to compile an app, is not the same as the classpath you use to run the application. When an application is run using java you still need to have the -cp to load all the supporting jars

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

Comments

1

One possibility:

Class.forName("this.will.throw.ClassNotFoundException")

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.