+ Start a Discussion
Elango VeeElango Vee 

Bulk API Example Code - Exception java.lang.NoClassDefFoundError: org/codehaus/jackson/ObjectCodec

Hi,

The bulk API example code: https://developer.salesforce.com/docs/atlas.en-us.200.0.api_asynch.meta/api_asynch/asynch_api_code_set_up_client.htm

The documentation says you need only partner.jar and wsc.jar.
Yet, when I compile the code I get the error...related to some JSON parsing library

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/ObjectCodec
at BulkExample.getBulkConnection(BulkExample.java:177)
at BulkExample.runSample(BulkExample.java:28)
at BulkExample.main(BulkExample.java:19)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.ObjectCodec
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)
... 3 more

Any help would be greatly appreciated...
 
Best Answer chosen by Elango Vee
Elango VeeElango Vee
The salesforce documentation was wrong!  

You need two additional JAR files in your classpath to run the sample code as it is (obviously with your own crendentials and sample data).

The two additional JAR files needed are:
jackson-core-asl.jar     http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-asl/1.9.13
jackson-mapper-asl.jar   http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-asl/1.9.13

 

All Answers

Elango VeeElango Vee
The salesforce documentation was wrong!  

You need two additional JAR files in your classpath to run the sample code as it is (obviously with your own crendentials and sample data).

The two additional JAR files needed are:
jackson-core-asl.jar     http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-asl/1.9.13
jackson-mapper-asl.jar   http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-asl/1.9.13

 
This was selected as the best answer
Mitesh SuraMitesh Sura
Hi Elango,

This was final nail in the coffin! For MAC users if you found this forum, probably you aare going nuts trying to figure out what is that you are doing wrong!! You are not alone. 

Here is what worked for me (pay attention to dots, blank space and colon!!!)
- java -classpath force-wsc-39.0.0.jar:rhino1.7.7/js.jar:ST-4.0.8.jar:. com.sforce.ws.tools.wsdlc ./partner.wsdl.xml ./partner.jar
- Imported partner.jar, force-wsc-39.0.0.jar and 2 jackson jar files mentioned above in the project

All my files were in download folder and I changed the folder in command prompt to point to that one. 

And it worked!