LinkageError: trying to refine class xx.class (bad class loader?)

hi,

am trying to define a class thru my custom classLoader by calling ClassLoader.defineClass() method . since few

classes are generated by this application and need to load those classes into JVM for introspection. when i run the application in Visualage for java its works fine, but when i run it at command prompt in jdk1.3 its bombing with java.lang.LinkageError also this happens only with classes generated by parsing Cics Commarea file.

anybody's could help me in this,

kumaran

[523 byte] By [kumaran2u] at [2007-9-26 8:36:20]
# 1

Hi,

I had the pretty same error message.

This turn out to happen when you have already loaded the class that you try to define, so if previous to define your class, you check if it is loaded, and if so, don't define it again, then, you won't run into it.

As a sample is better than thousands words here you have:

i.e. you have :

Class c = defineClass(name, bytes, 0, bytes.length);

resolveClass(c);

return c;

do instead:

Class c = findLoadedClass (name);// Check if the class is already loaded

if (c == null)// The class was not previously loaded, so we define it and resolve it

// Otherwise we simply return the class already loaded

{

c = defineClass(name, bytes, 0, bytes.length);

resolveClass(c);

}

return c;

HTH

Lumi

iponces at 2007-7-1 19:20:28 > top of Java-index,Java HotSpot Virtual Machine,Specifications...