1 2 Previous Next 18 Replies Latest reply on Feb 9, 2010 12:11 PM by alesj

    Help: Error [Instrumentor] AOP Instrumentor failed

      Hi, i try to integrate jboss AOP with riftsaw 2.0 M1 for my thesis work at the university.

      I tried examples in "injboss" section and they run correctly.

       

       

      When i try to intercept a method of riftsaw [org.apache.ode.axis2.soapbinding.SoapExternalService-> invoke() ] during the execution of a web services within wotkflowi obtain an exception. Why i obtain that error a runtime ? I'm using jboss 5.1.0 jdk6,  jboss AOP  2.1.5 and my aop.xml file is so simple :

       

       

      15:31:33,251 ERROR [Instrumentor] [warn] AOP Instrumentor failed to transform or
      g.apache.ode.axis2.soapbinding.SoapMessageConverter
      javassist.CannotCompileException: [source error] no such a constructor
              at javassist.CtBehavior.setBody(CtBehavior.java:368)
              at javassist.CtBehavior.setBody(CtBehavior.java:334)
      

       

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
      
      <prepare expr="all(org.apache.ode.axis2.soapbinding.SoapExternalService)" />
      
      <interceptor class="test.aop.Simplex" scope="PER_VM"/>
      
      <bind pointcut="execution(* $instanceof{org.apache.ode.axis2.soapbinding.SoapExternalService}->invoke(..))" >
      <interceptor-ref name="test.aop.Simplex" />
      </bind>
      </aop>
      

       

      Please to help me !!!

        • 1. Re: Help: Error [Instrumentor] AOP Instrumentor failed
          flavia.rainone

          It looks like a problem very similar to this is bug https://jira.jboss.org/jira/browse/JBAOP-734.

          Could you please post the entire stack trace of the CannotCompileException so I can see when exactly is the exception being thrown?

          • 2. Re: Help: Error [Instrumentor] AOP Instrumentor failed

            Flavia thanks for the reply, i'm developing a project for my thesis and i stop my work  because i don't outride this problem.

             

            Follow stack trace:

             

            2010-01-20 11:54:51,864 ERROR [org.jboss.aop.instrument.Instrumentor] (main) [warn] AOP Instrumentor failed to transform org.apache.ode.axis2.soapbinding.SoapExternalService
            javassist.CannotCompileException: [source error] no such a constructor
                 at javassist.CtBehavior.setBody(CtBehavior.java:368)
                 at javassist.CtBehavior.setBody(CtBehavior.java:334)
                 at javassist.CtConstructor.setBody(CtConstructor.java:216)
                 at org.jboss.aop.instrument.GeneratedAdvisorInstrumentor.createAdvisorCtors(GeneratedAdvisorInstrumentor.java:440)
                 at org.jboss.aop.instrument.GeneratedAdvisorInstrumentor.createAdvisorClass(GeneratedAdvisorInstrumentor.java:313)
                 at org.jboss.aop.instrument.GeneratedAdvisorInstrumentor.doSetupBasics(GeneratedAdvisorInstrumentor.java:561)
                 at org.jboss.aop.instrument.Instrumentor.setupBasics(Instrumentor.java:949)
                 at org.jboss.aop.instrument.MethodExecutionTransformer.instrument(MethodExecutionTransformer.java:143)
                 at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:744)
                 at org.jboss.aop.instrument.GeneratedAdvisorInstrumentor.transform(GeneratedAdvisorInstrumentor.java:117)
                 at org.jboss.aop.SuperClassesFirstWeavingStrategy.instrumentClass(SuperClassesFirstWeavingStrategy.java:202)
                 at org.jboss.aop.SuperClassesFirstWeavingStrategy.translate(SuperClassesFirstWeavingStrategy.java:69)
                 at org.jboss.aop.AspectManager.translate(AspectManager.java:1071)
                 at org.jboss.aop.AspectManager.transform(AspectManager.java:1015)
                 at org.jboss.aop.standalone.AOPTransformer.aspectTransform(AOPTransformer.java:87)
                 at org.jboss.aop.standalone.AOPTransformer.transform(AOPTransformer.java:75)
                 at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
                 at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
                 at java.lang.ClassLoader.defineClass1(Native Method)
                 at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
                 at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
                 at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
                 at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
                 at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
                 at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
                 at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
                 at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
                 at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)
                 at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:150)
                 at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)
                 at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
                 at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
                 at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
                 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
                 at org.apache.ode.axis2.hooks.ODEAxisServlet.createODEServer(ODEAxisServlet.java:67)
                 at org.apache.ode.axis2.hooks.ODEAxisServlet.init(ODEAxisServlet.java:52)
                 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
                 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
                 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122)
                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4421)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
                 at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
                 at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
                 at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
                 at $Proxy38.start(Unknown Source)
                 at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                 at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                 at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                 at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                 at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                 at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                 at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
                 at org.jboss.system.ServiceController.start(ServiceController.java:460)
                 at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
                 at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
                 at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                 at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                 at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                 at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                 at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                 at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                 at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                 at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
                 at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
                 at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                 at org.jboss.Main.boot(Main.java:221)
                 at org.jboss.Main$1.run(Main.java:556)
                 at java.lang.Thread.run(Thread.java:619)
            Caused by: compile error: no such a constructor
                 at javassist.compiler.MemberCodeGen.atMethodCallCore2(MemberCodeGen.java:593)
                 at javassist.compiler.MemberCodeGen.atMethodCallCore(MemberCodeGen.java:575)
                 at javassist.compiler.MemberCodeGen.atCallExpr(MemberCodeGen.java:523)
                 at javassist.compiler.JvstCodeGen.atCallExpr(JvstCodeGen.java:243)
                 at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
                 at javassist.compiler.CodeGen.atStmnt(CodeGen.java:337)
                 at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
                 at javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
                 at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
                 at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:291)
                 at javassist.compiler.Javac.compileBody(Javac.java:222)
                 at javassist.CtBehavior.setBody(CtBehavior.java:360)
                 ... 109 more
            
            • 3. Re: Help: Error [Instrumentor] AOP Instrumentor failed
              flavia.rainone

              Taking a look at the piece of code that throws that exception, in GeneratedAdvisorInstrumentor.createAdvisorCtors:

               

              //This will be called when a class instantiates its advisor
              CtConstructor ctor = CtNewConstructor.defaultConstructor(genadvisor);
              ctor.setBody(
                  "{" +
                  "   super(\"" + clazz.getName() + "\"); " +
                  "   initialise(org.jboss.aop.AspectManager.instance(org.jboss.aop.advice.SecurityActions.getClassLoader(this.getClass())), false);" + //Use the CL of the class, since we may be in a scoped loader
                  "}");
              genadvisor.addConstructor(ctor);
              

               

              I think it doesn't make too much sense, since the constructor is created in the previous line.

              Maybe this is a Javassist bug. Kabir, what do you think of this?

              • 4. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                kabirkhan

                flavia.rainone@jboss.com wrote:

                 

                Taking a look at the piece of code that throws that exception, in GeneratedAdvisorInstrumentor.createAdvisorCtors:

                 

                //This will be called when a class instantiates its advisor
                CtConstructor ctor = CtNewConstructor.defaultConstructor(genadvisor);
                ctor.setBody(
                    "{" +
                    "   super(\"" + clazz.getName() + "\"); " +  // <<<<<<<<<<<<<<<<<<<
                    "   initialise(org.jboss.aop.AspectManager.instance(org.jboss.aop.advice.SecurityActions.getClassLoader(this.getClass())), false);" + //Use the CL of the class, since we may be in a scoped loader
                    "}");
                genadvisor.addConstructor(ctor);
                

                 

                I think it doesn't make too much sense, since the constructor is created in the previous line.

                Maybe this is a Javassist bug. Kabir, what do you think of this?

                I remember seeing this error in the past, but not exactly what causes it. I think the problem is with the call to super(String) that I marked. Is the super class getting woven?
                Actually looking at SoapExternalService.java  it seems to be a base class so that there should be no super advisor. If I am looking at the right version of SoapExternalService, the question is why does it think it is not the base class?

                • 5. Re: Help: Error [Instrumentor] AOP Instrumentor failed

                  I tried also to intercept other methods( in other packages) of riftsaw webapp but i obtain always the same exception!! Any suggestion to resolve this problem?

                   

                  thanks a lot!!!!!!

                  • 6. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                    flavia.rainone

                    Can you enable the verbose mode of AOP to see which classes are being woven?

                    Maybe that can show us why is there an unexpected super class?

                    • 7. Re: Help: Error [Instrumentor] AOP Instrumentor failed

                      I resolved with the new version of jboss-AOP 2.1.8.

                       

                       

                      Do you suggest me an example about how modify arguments in a advice function of a method defined by pointcut?

                       

                      Thanks in advance

                       

                      Marco

                      • 8. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                        kabirkhan
                        public Object invoke(MethodInvocation inv) throws Throwable{
                           Object[] args = inv.getArguments();
                        
                            args[2] = "Replaced";
                        
                            return inv.invokeNext();
                        }
                        

                         

                        If the advice is used for several methods, you'd obviously need to do some checking of the types and numbers of paramters, but I've given you the general idea.

                        • 9. Re: Help: Error [Instrumentor] AOP Instrumentor failed

                          I have one question...

                           

                          In my DemoAspect.class i have that part of code:

                           

                          .
                          .
                          .
                          
                          if (arg[0] instanceof MessageContext)
                                   {
                                        MessageContext msg = (MessageContext)arg[0];
                                        info.append("\nMessageEnvelope :" + msg.getEnvelope().toString());
                                        
                                  }
                          .
                          .
                          .
                          
                          

                           

                          MessageContext.Class is argument's type that i want change and it is in a jar file contained under riftsaw.sar/bpel.war/WEB-INF/lib

                          while my AOP path is riftsaw.sar/demo.aop

                           

                          When try to invoke a service i obtain a ClassLoaderNotFoundException throws by DemoAspect.class because  MessageContext class is not found.

                           

                          Is possible to specify a jar path ? If yes...where?

                          Or i must follow another strategy?

                           

                          Thanks

                          • 10. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                            kabirkhan

                            The classes in war/lib will be in a child classloader of the classloader that the sar and aop archive belong to hence the CNFE.

                             

                            You would need to do something like

                             

                            Class<?> clazz = arg[0].getClass().getClassLoader().load("name.of.Class")

                             

                            In this case you seem to want to do stuff to the instance, so I suggest bundling this into a util method and calling that via reflection from your aspect.

                            • 11. Re: Help: Error [Instrumentor] AOP Instrumentor failed

                              Thanks in that way i obtain a total control on types passed as arguments.

                               

                              Now i must work only via reflection and i can't make a cast to simplify my program. Is correct my idea?

                              • 12. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                                kabirkhan

                                Correct, since MessageContext is not visible in the classloader loading the Aspect class you are stuck with reflection.

                                 

                                Another option would be to put the jar containing MessageContext directly in the .sar (next to the .aop) then it will be visible from everything in the sar. The problem in this case is if you have several applications/deployments needing that jar. If they each keep it in WEB-INF/lib you have isolation between the different applications so they can each run their own version. If that is the case you could still put it in the .sar, but make sure you use Class loader isolation http://community.jboss.org/message/524424#524424

                                • 13. Re: Help: Error [Instrumentor] AOP Instrumentor failed

                                  Thanks for the reply....i have moved jar file in sar directory and now i can instantiate a MessageContext object, but when i try to casting argument:

                                   

                                  .
                                  .
                                  .
                                  MessageContext msg = (MessageContext) arg[0];
                                  .
                                  .
                                  .
                                  

                                   

                                  I obtain an error at run-time:

                                   

                                  java.lang.ClassCastException: org.apache.axis2.context.MessageContext cannot be cast to org.apache.axis2.context.MessageContext
                                  

                                   

                                  It is very strange....depends on different class loader ?

                                  • 14. Re: Help: Error [Instrumentor] AOP Instrumentor failed
                                    kabirkhan
                                    That could happen if you have several deployments containing the MessageContext class (there might be one bundled with the app server for all I know), hence my earlier comment about classloader isolation
                                    1 2 Previous Next