3

I get the below exception even after having json.jar and commons-collections.jar in classpath. It fails exactly at the import statement for JSONException

Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:509)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
... 30 more
3
  • Are you sure above jar is on classpath? Version correct? Commented Sep 24, 2013 at 20:43
  • open the json.jar you have, and look for the class org.json.JSONException Commented Sep 24, 2013 at 20:52
  • @SajanChandran It exists in the jar. Commented Sep 24, 2013 at 20:57

2 Answers 2

2

That looks like a runtime error, not a compile error, so the build path probably doesn't help you. Do you have those jars in your classpath? That's what's used at runtime to find classes.

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

2 Comments

I had to add the jar to web module's classpath, i.e, WEB-INF/lib. I did this by selecting the jar from Web Libraries in Java EE Module dependencies, and so it overrides the MANIFEST classpath which is not cooperative with json
1

Put your JAR libraries into the WEB-INF/lib folder.

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.