JBoss Community

VerifyError, Bad type in putfield/putstatic

created by Sergio Celentano in Javassist - View the full discussion

Hi guys,

I am running into some problems while trying to use javassist facilities to implement a java fault injection tool.

 

As an application (lets call it "worklaod") invokes a method from a third-party library, my tool should intercept this method, modify the parameters value on-the-fly and call the original method.

Running through the tutorials provided with javassist library I found that the "sample/reflect/*.java" should suit my case and I took it into account as a starting point to implement my tool.

 

So, following that tutorial, my "Injection" class extends the "javassist.tools.reflect.Metaobject" class and implement the "trapMethodCall()" method, in which I realize the arguments substitution.

Another class (my.wrapper.Controller) implements the following snippet, in which "my.app.SubImpl" is the workload and "classNam" is the class whose methods I want to intercept:

 

        Loader cl = (Loader)my.app.SubImpl.class.getClassLoader();

        String className = "org.opensplice.dds.dcps.FooTypeSupportImpl";

        String metaObject = "my.wrapper.Injector";

        try {

            cl.makeReflective(className,

                              metaObject,

                              "javassist.tools.reflect.Metaobject");

 

            cl.run("my.app.SubImpl", args);

     ...


The problem rises when I run my program with this statement "java javassist.tools.reflect.Loader my.wrapper.Controller", I get this error:

 

java.lang.VerifyError: (class: org/opensplice/dds/dcps/FooTypeSupportImpl, method: <clinit> signature: ()V) Bad type in putfield/putstatic

 

Furthermore I must say that the class "org.opensplice.dds.dcps.FooTypeSupportImpl" is an abstract class and methods I want to intercept are public and static and I am almost sure that this is the main cause of the issue. I wonder if there's any work-around for it.

 

I hope my explanation was enough clear, any advice is appreciated =)

Thank in advance,

 

Sergio

Reply to this message by going to Community

Start a new discussion in Javassist at Community