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
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
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
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
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