[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo [RESOLVED]

2009-06-05 Thread ad-rocha
You´re righit Chiba. The code below did the trick. Thank you very much for your help! | ClassWorld world = new ClassWorld(); | | ClassRealm realm = world.newRealm("org.codecompany.jeha.plugin", |Thread.currentThread().getContextClassLoader()); | | ClassRealm runRealm = real

[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo

2009-06-04 Thread ad-rocha
Chiba, It seems that testng-5.8-jdk15.jar is already in classpath. Look at this: Thread.currentThread().getContextClassLoader() and classPool.getClass().getClassLoader() are the same: System.out.println(Thread.currentThread().getContextClassLoader()): | ClassRealm[/plugins/org.codecompany:j

[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo

2009-06-04 Thread chiba
OK, the problem is that the context class loader obtained by: Thread.currentThread().getContextClassLoader() could not find org.testng...BeforeMethod. So you must add testng-5.8-jdk15.jar to the class path of the context class loader. Otherwise, you can add that jar file to the class path of t

[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo

2009-06-04 Thread ad-rocha
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 (NotFoundExc

[jboss-user] [Javassist user questions] - Re: Using Javassist inside Mojo

2009-06-04 Thread chiba
Have you checked the ClassPool object can access BeforeMethod? Please try: method.getDeclaringClass().getClassPool().get("org.testng...BeforeMethod") If this returns null, the ClassPool does not know how to obtain the class file. Maybe the appended class path is wrong. Otherwise, something I