[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo
ad-rocha
do-not-reply at jboss.com
Thu Jun 4 08:02:45 EDT 2009
Thanks for your reply Chiba.
I added this chek just before calling getAnnotations() and the class was found:
| try {
| CtClass c = method.getDeclaringClass().getClassPool().get("org.testng.annotations.BeforeMethod");
| System.out.println("FOUND: " + c);
| } catch (NotFoundException e) {
| System.out.println("NOT FOUND: " + e);
| }
| // error happens here
| annotations = method.getAnnotations();
|
Console prints:
| FOUND: javassist.CtClassType at 1a697a1[public abstract interface class org.testng.annotations.BeforeMethod implements java.lang.annotation.Annotation, fields= constructors= methods=javassist.CtMethod at da59c402[public abstract enabled ()Z], javassist.CtMethod at 1e2eb9d5[public abstract groups ()[Ljava/lang/String;], javassist.CtMethod at 87eeb3bb[public abstract dependsOnGroups ()[Ljava/lang/String;], javassist.CtMethod at 9b4f6f0d[public abstract dependsOnMethods ()[Ljava/lang/String;], javassist.CtMethod at 8b8eb7fd[public abstract alwaysRun ()Z], javassist.CtMethod at a79e83f0[public abstract inheritGroups ()Z], javassist.CtMethod at 21e479fd[public abstract description ()Ljava/lang/String;], javassist.CtMethod at 331b2daa[public abstract firstTimeOnly ()Z], ]
|
Stack trace is:
| ...
| Caused by: java.lang.ClassNotFoundException: org.testng.annotations.BeforeMethod
| at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
| at org.codehaus.plexus.classworlds.realm.ClassRealm.loadRealmClass(ClassRealm.java:174)
| at org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultStrategy.java:67)
| at org.codehaus.plexus.classworlds.strategy.ForeignStrategy.loadClass(ForeignStrategy.java:39)
| at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:201)
| at org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultStrategy.java:73)
| at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:201)
| at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
| at java.lang.Class.forName0(Native Method)
| at java.lang.Class.forName(Class.java:247)
| at javassist.bytecode.annotation.MemberValue.loadClass(MemberValue.java:51)
| at javassist.bytecode.annotation.Annotation.toAnnotationType(Annotation.java:293)
| at javassist.CtClassType.toAnnoType(CtClassType.java:591)
| at javassist.CtClassType.toAnnotationType(CtClassType.java:492)
| at javassist.CtBehavior.getAnnotations(CtBehavior.java:185)
| at javassist.CtBehavior.getAnnotations(CtBehavior.java:156)
| at org.codecompany.jeha.mojo.Transformer.isAnnotated(Transformer.java:224)
| at org.codecompany.jeha.mojo.Transformer.transform(Transformer.java:94)
| ... 23 more
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4235307#4235307
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4235307
More information about the jboss-user
mailing list