parispurchase / json-io

Automatically exported from code.google.com/p/json-io
0 stars 0 forks source link

loadClass(name) raises ClassNotFound Exception although Class exists / solution available #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using JsonReader.jsonToJava(String message) in a "MessageTextEncoder"-Class 
inside Method "public Message decode(String string) throws DecodeException" for 
a WebLogic Server (e.g. WildFly). See 
http://docs.oracle.com/middleware/1213/wls/WLPRG/websockets.htm.

What is the expected output? What do you see instead?
* The expected output should be the created Object out of the JSON Text.
* Instead a "error" cause of a "ClassNotFound"-Exception is raised: 
23:28:23,638 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.error(JsonReader.java:3240)
23:28:23,639 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.classForName(JsonReader.java:2975)
23:28:23,639 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.createJavaObjectInstance(JsonReader.java:21
04)
23:28:23,639 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.convertParsedMapsToJava(JsonReader.java:123
2)
23:28:23,639 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.readObject(JsonReader.java:1193)
23:28:23,639 ERROR [stderr] (default I/O-3)     at 
com.cedarsoftware.util.io.JsonReader.jsonToJava(JsonReader.java:1085)

* Solution would be:
Please change JsonReader.java:3022
From: currentClass = 
Thread.currentThread().getContextClassLoader().loadClass(className);
To: currentClass = Class.forName( className );

What version of the product are you using? On what operating system?
Version: json-io: 2.7.0
OS: OS X 10.9.4
Java: JavaSE-1.8

Please provide any additional information below.
* Solution would be:
Please change JsonReader.java:3022
From: currentClass = 
Thread.currentThread().getContextClassLoader().loadClass(className);
To: currentClass = Class.forName( className );

Original issue reported on code.google.com by EDV.Goog...@LoesungsArbeit.net on 21 Aug 2014 at 10:11

Attachments: