JSONException 에러 관련


JSONArray, JSONException, JSONObject 등 json 처리 후 서버에 업로드 후 부팅 시 아래와 같은 에러가 발생하였음



 Caused by: java.lang.IllegalStateException: Failed to introspect Class [ 파일이름 ] from ClassLoader [ParallelWebappClassLoader

  context: ROOT

  delegate: false

----------> Parent Classloader:

java.net.URLClassLoader@37f8bb67

]

        at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]

        at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:267) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

        ... 48 common frames omitted

Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/configurationprocessor/json/JSONException

        at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_201]

        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_201]

        at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_201]

        at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]

        ... 50 common frames omitted

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.configurationprocessor.json.JSONException

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365) ~[catalina.jar:9.0.37]

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188) ~[catalina.jar:9.0.37]

        ... 54 common frames omitted



여기저기 검색해 보니 json 관련해서 잘못 dependency 되어 있는 문제였음


기존 : org.springframework.boot.configurationprocessor.json.JSONArray

변경 : org.json.JSONArray


maven


<dependency>

   <groupId>org.json</groupId>

   <artifactId>json</artifactId>

   <version>20200518</version>

</dependency>

 


gradle


implementation 'org.json:json:20200518'

 


디펜던시 참고 : https://javalibs.com/artifact/org.json/json





+ Recent posts