Menu

#185 NeoDatisError:228:Error while creating (reflection) class [B

open
nobody
engine (145)
5
2011-02-21
2011-02-21
Tom
No

I get NeoDatisError:228:Error while creating (reflection) class [B When attempting to call the store() method on an object. After some researching, it appears that it is due to a behavior change in JDK5 -> JDK6 where the loadClass doesn't work with primitive arrays (the object I'm trying to store contains byte arrays).

Here is a better description than I can provide: https://issues.jboss.org/browse/JBCACHE-1104

Also, I was able to recompile neodatis and have it work with the following hack:

In the file ODBClassPool.java change the getClass method as follows:

public synchronized Class getClass(String className) {
Class clazz = classMap.get(className);
if (clazz == null) {
try {
// clazz =
// Thread.currentThread().getContextClassLoader().loadClass
// (className);
clazz = OdbConfiguration.getClassLoader().loadClass(className);
} catch (Exception e) {

// Check if it is a native class
clazz = nativeClasses.get(className);

if(clazz==null){
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
clazz = null;
}
}
if(clazz==null){
throw new ODBRuntimeException(NeoDatisError.CLASS_POOL_CREATE_CLASS
.addParameter(className), e);
}
}
classMap.put(className, clazz);
}
return clazz;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.