Bluemix Java Liberty Web Project java.lang.NoClassDefFoundError: when loading third party jar

Im using IBM Bluemix’s Java For Liberty to deploying a web app.

I was trying to get the system env and converted it to JSONObject

enter image description here

And I pretty sure Ive added the jar file to the classpath

enter image description here

However, after I ran the app(tried push to bluemix cloud and running locally in a liberty profile app server), it throws java.lang.NoClassDefFoundError

enter image description here

please indicate how should I configure…..

Answer

The jars in the dep-jar folder do NOT get packaged with the final application binary(war). It is meant to be used during compilation only. If you want the jar to be included in the war (use during runtime), you need to include it in WebContent/WEB-INF/lib folder.

If you create and download the Java DB Web Starter boilerplate, you will see the right structure set up – WebContent/WEB-INF/lib/nosqljson.jar

Leave a Reply

Your email address will not be published. Required fields are marked *