Using 4.2.0CR2.
I am using TestNG from within a Stateless Session Bean. The TestNG jar for jdk1.5 is in the ear/lib directory, and I can import the main TestNG class just fine, so I know it is actually on the classpath. TestNG uses reflection internally to load and instantiate some TestRunners, etc. I get:
java.lang.NoSuchMethodException: org.testng.internal.annotations.JDK15AnnotationFinder.<init>(org.testng.internal.annotations.IAnnotationTransformer) java.lang.Class.getConstructor0(Class.java:2647) java.lang.Class.getConstructor(Class.java:1629) org.testng.internal.ClassHelper.createJdkAnnotationFinder(ClassHelper.java:175) org.testng.TestNG.initializeAnnotationFinders(TestNG.java:692) org.testng.TestNG.run(TestNG.java:701)
try { Class clazz= forName(JDK5_ANNOTATIONFINDER_CLASS); Constructor ctor= clazz.getConstructor(new Class[] {IAnnotationTransformer.class});//Exception here return (IAnnotationFinder) ctor.newInstance(new Object[] {annoTransformer}); } catch(Exception ex) { throw new TestNGException("Cannot create/initialize the JDK5 annotation finder " + JDK5_ANNOTATIONFINDER_CLASS, ex); }