asked on
Caused by: java.lang.NoClassDefFoundError: org.json.JSONObject error
hi,
Getting below type of error from my micro service project consuming from IBM MQ while starting the server on Intellij IDEA
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mqQueueConnectionFactory' defined in class path resource [com/aaa/bbb/ccc/config/ConnectionConfiguration.class]: Post-processing of merged bean definition failed
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.ibm.mq.jms.MQQueueConnectionFactory] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@7]
Caused by: java.lang.NoClassDefFoundError: org.json.JSONObject
Please advise
ASKER
I checked .m2 setting file which is pointing to C:\Users\xyz\mavenRepo to download jar dependencies.
I deleted all jar dependencies. I updated below plugin entry by adding plexus archiver
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.22</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.8.0</version>
</dependency>
</dependencies>
Now I am getting below error. Do not see that JsonObject error. Can you please advise. Should I open a new question as this is kind of different issue but similar or follow up on this same question?
15:18:52.281 [main] INFO aaa.bbb.CccApplication - The following 1 profile is active: "LOCAL"
15:18:54.055 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
Caused by: java.lang.IllegalStateException: Failed to introspect Class [aaa.bbb.ccc.ddd.config.ConnectionConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@257c055]
Caused by: java.lang.NoClassDefFoundError: com.ibm.mq.jms.MQQueueConnectionFactory
at java.base/java.lang.Class.getDeclaredMethodsImpl(Native Method)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:1180)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)
... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.jms.MQQueueConnectionFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:827)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1094)
... 36 common frames omitted
15:18:54.072 [main] WARN o.s.boot.SpringApplication - Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class [aaa.bbb.ccc.ddd.config.ConnectionConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@257c055]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483)
ASKER
which one i have to add. I am using ibm mq
ASKER
intellij idea 2021 has cache issues. I used idea 2023 do not see these errors
ASKER
Thank you. Do you know what goes in place of x.y in the jar file name? Not sure if this jar pulled by any framework or any other dependency jar or stand alone jar?