From: robert.schwegler <nu...@jb...> - 2005-07-07 21:05:54
|
It took me many many hours and finally here is the right hint! I'm using JDK5, aop1.3 and 4.0.3RC1. Now as I'm using AspectManagerServiceJDK50, I see much more information in the log, but I'm looking for an example with the JBoss Server. Are there any tricks with the class-loader? I wrote an XMBean and deployed it in a sar-directory: package xmbeanprimer; | import xmbeanprimer.Traceable; | import xmbeanprimer.Billable; | public class Greeter { | private int greetingsSent = 0; | @Billable | public String hello() { | this.setGreetingsSent(this.greetingsSent+1); | return "Hello World (" + this.greetingsSent + ")!"; | } | public int getGreetingsSent() { | return this.greetingsSent; | } | public void setGreetingsSent(int c) { | this.greetingsSent = c; | } | } I wrote an aspect and put it in a jar called: adp.aop with an advice: ... | @Bind (pointcut="execution(java.lang.String xmbeanprimer.Greeter->@Billable( | ))") | public Object methodAdvice(MethodInvocation invocation) throws Throwable { | ... My BillingAdvice got deployed: 22:47:52,119 INFO [STDOUT] [debug] Looking for aspects in: adp.BillingAdvice | 22:47:52,139 INFO [STDOUT] [debug] Found @Aspect in: adp.BillingAdvice | 22:47:52,249 INFO [STDOUT] [trying to transform] $Proxy54 | 22:47:52,249 INFO [STDOUT] [debug] There are no caller pointcuts! | 22:47:52,259 INFO [STDOUT] [debug] was $Proxy54 converted: false | 22:47:52,419 INFO [STDOUT] [trying to transform] $Proxy55 | 22:47:52,419 INFO [STDOUT] [debug] There are no caller pointcuts! | 22:47:52,429 INFO [STDOUT] [debug] was $Proxy55 converted: false | 22:47:52,549 INFO [AspectDeployer] Deployed AOP: file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/deploy/adp.aop But my Advice is not found: 22:47:54,913 INFO [STDOUT] method matched binding execution(* *->@xmbeanprimer.Billable(..)) public java.lang.String xmbeanprimer.Greeter.hello() | 22:47:54,913 INFO [STDOUT] [debug] added advisor: xmbeanprimer.Greeter from binding: jar:file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/tmp/deploy/tmp51167adp.aop!/META-INF/jboss-aop.xml0 | 22:47:54,993 ERROR [MainDeployer] Could not create deployment: file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/deploy/greeter01.sar/ | org.jboss.deployment.DeploymentException: java.lang.ClassNotFoundException: No ClassLoaders found for: adp.BillableInterceptor; - nested throwable: (java.lang.RuntimeException: java.lang.ClassNotFoundException: No ClassLoaders found for: adp.BillableInterceptor) Thanks for any hints how to package it cleanly. My target is to do runtime weaving! I checked the examples but all of them compile all the files in one directory. Have I overseen an example? Regards Robert Schwegler, Amadeus View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884098#3884098 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884098 |