问题
I am using Twilio to send SMS messages from my web app and I have almost completed the integration. It's sending the SMS, but an error is being generated and I don't understand why. I have included a JSON dependency from this json and this file link but I'm still getting an error. Which other jar do I need to include?
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonParseException
at com.twilio.sdk.TwilioRestResponse.getParser(TwilioRestResponse.java:225)
at com.twilio.sdk.TwilioRestResponse.toMap(TwilioRestResponse.java:243)
at com.twilio.sdk.resource.list.SmsList.create(SmsList.java:70)
at Example.main(Example.java:25)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 4 more
screenshot showing json added
Update this is the new screesnshot
回答1:
You have missed jackson-core-asl.jar 1.9.13 in you project. You can make use of this Maven POM dependency
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
Hope this solves your problem. Check this link for more information. Direct link for download
Class is present in the jar Screen below
Remove your java-json.jar and add the jackson-core-asl.jar
来源:https://stackoverflow.com/questions/19487628/exception-in-thread-main-java-lang-noclassdeffounderror-org-codehaus-jackson