Exception in thread “main” java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonParseException

落爺英雄遲暮 提交于 2019-12-01 06:33:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!