Re: [aspectwerkz-user] class not found exception after hotdeploy - please help
Alexandre Vasseur <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
Hi From the message AW::WARNING - could not load class [org/appfuse/model/User$$BulkBeanByCGLIB$$f86a5545] as a resource in loader [WebappClassLoader I can see that your app is using CGLib proxy. CGLib proxy cannot be weaved under the default configuration since there is no way to get their unweaved bytecode (since it is a proxy somehow, there is no .class file). You could try to exclude them from your deployment scope following their name patterrn : AND ! within(org.appfuse..*ByCGLIB*) or something like that We have published an extension to actually expose CGLib proxy to the weaver. You have to build it from the dist. See *bottom of* http://aspectwerkz.codehaus.org/new_features_in_2_0.html#AWProxy:_proxy_awareness_of_aspects Alex On Apr 8, 2005 8:07 PM, Mihir Mehta <[email protected]> wrote: > > Hi, > > It seems to be related to my not fully understanding > the relationships between deployment scope, > aspect/pointcut and classloaders. > > I have the following scenario. I put a jar file with > the aspect and aop.xml in WEB-INF/lib to define a > deployment scope. > > Here is the aop.xml > <!DOCTYPE aspectwerkz PUBLIC > "-//AspectWerkz//DTD//EN" > > "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd"> > > <aspectwerkz> > <system id="webapp"> > <aspect class="demoaspect.DemoAspect"> > <deployment-scope name="response_time" > expression="execution(public * org.appfuse..*.*(..)) > AND !within(demoaspect..*)"/> > </aspect> > </system> > </aspectwerkz> > > When one of the web action is invoked I deploy the > aspect using following code. > > if > (user.getUsername().equalsIgnoreCase("hotdeploy")) { > log.info("encountered 'hotdeploy' user"); > SystemDefinition sysDef = > SystemDefinitionContainer. > > getDefinitionFor(this.getClass().getClassLoader(), > "webapp"); > if(sysDef != null) { > log.info("found system definition"); > System.out.println("SystemDefinition > found!"); > DeploymentScope scope = > sysDef.getDeploymentScope("response_time"); > log.info("found deployment scope : " + > scope.getExpression()); > System.out.println("Scope is: > "+scope.getExpression()); > if (scope != null) { > DeploymentHandle handle = > Deployer.deploy(DemoAspect.class, > "<aspect name='measureTime'>" + > "<pointcut name='usermanager' " + > "expression='execution(public * > org.appfuse.service.UserManager.*.*(..)) AND > !within(demoaspect..*)' " + > "/> " + > "<advice name='trace' type='around' > bind-to='usermanager'/> " + > "</aspect>",scope); > > } > } > } > > When this piece of code is called I get following > exception. I am including some enclosing print > statements too: > > demoapp] INFO [http-8080-Processor23] > SignupForm.aw$original$_AW_$save$_AW_$org_appfuse_webapp_action_SignupForm(82) > | encountered 'hotdeploy' user > [demoapp] INFO [http-8080-Processor23] > SignupForm.aw$original$_AW_$save$_AW_$org_appfuse_webapp_action_SignupForm(86) > | found system definition > SystemDefinition found! > [demoapp] INFO [http-8080-Processor23] > SignupForm.aw$original$_AW_$save$_AW_$org_appfuse_webapp_action_SignupForm(89) > | found deployment scope : execution(public * > org.appfuse..*.*(..)) AND !within(demoaspect..*) > Scope is: execution(public * org.appfuse..*.*(..)) AND > !within(demoaspect..*) > Deployer::INFO - deploying aspect > [demoaspect.DemoAspect] in class loader > [WebappClassLoader > delegate: false > repositories: > /WEB-INF/classes/ > ----------> Parent Classloader: > org.apache.catalina.loader.StandardClassLoader@18ca663 > ] > AW::WARNING - could not load class > [org/appfuse/model/User$$BulkBeanByCGLIB$$f86a5545] as > a resource in loader [WebappClassLoader > delegate: false > repositories: > /WEB-INF/classes/ > ----------> Parent Classloader: > org.apache.catalina.loader.StandardClassLoader@18ca663 > ] > .... > Caused by: java.io.IOException: Class not found > at > org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:317) > at > org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:331) > at > org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo.createClassInfoFromStream(AsmClassInfo.java:790) > at > org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:273) > at > org.codehaus.aspectwerkz.transform.inlining.compiler.JoinPointFactory.getJoinPointsMatching(JoinPointFactory.java:158) > at > org.codehaus.aspectwerkz.transform.inlining.deployer.Deployer.redefine(Deployer.java:402) > at > org.codehaus.aspectwerkz.transform.inlining.deployer.Deployer.deploy(Deployer.java:306) > at > org.codehaus.aspectwerkz.transform.inlining.deployer.Deployer.deploy(Deployer.java:241) > at > org.appfuse.webapp.action.SignupForm.aw$original$_AW_$save$_AW_$org_appfuse_webapp_action_SignupForm(SignupForm.java:93) > at > org.appfuse.webapp.action.SignupForm_1__1085656376_3523570___AW_JoinPoint.invoke(Unknown > Source) > at > org.appfuse.webapp.action.SignupForm.save(SignupForm.java) > 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:585) > at > net.sourceforge.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:135) > ... 58 more > Caused by: java.io.IOException: Class not found > at > org.codehaus.aspectwerkz.org.objectweb.asm.ClassReader.readClass(Unknown > Source) > at > org.codehaus.aspectwerkz.org.objectweb.asm.ClassReader.<init>(Unknown > Source) > at > org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:304) > ... 73 more > >