0

Hello I am getting error in Production while deploying my jar file , for the JSONArray class not found in the Jar which I have provided in the production.

The error is coming from my STS Eclipse project from the below code Initializing the JSONArray which i have added as below -

[Code](https://i.stack.imgur.com/1IPN1.png)

And I have also verified that the json library module is added in my pom.xml as well as shown below

enter image description here

i am building the jar file of my Eclipse project by Run As -> Maven Clean and then Run as -> Maven Build.

There is no compilation error in my STS/Eclipse at compile time. But in Production log - i am getting Caused by: java.lang.NoClassDefFoundError: org/json/JSONArray.

Any suggestion is greatly appreciated.

I tried reinstalling maven and run a clean build but still getting same issue.

I have also added below additional plugins in my pom.xml to try but no luck -

enter image description here Verified the Maven Dependencies have the org.json

Maven Dependencies

i have also verified he build configuration , even there the maven dependencies is added and showing me the org.json package references.

Build Path Configuration

Please suggest !!

Satyajit
  • 1
  • 1
  • 1
    a simple `mvn package` usually builds a JAR file that only contains your own classes. If you want to build a _fat jar_, you have to use some more tools, like the maven shade plugin or the maven assembly plugin. – Seelenvirtuose Jun 20 '23 at 16:47
  • @Seelenvirtuose , I have used the Maven Shade Plugin , it doesnot help. Does this external jars which i am sending to CLient should also have the json-20210307.jar file ? – Satyajit Jun 21 '23 at 16:28

0 Answers0