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)
|
The relevant section of ClassHelper.java is:
| 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);
| }
|
Please note that I added the comment showing which line throws the exception (line 175)
It works fine when called from the web context if the jar is in WEB-INF/lib, but that
doesn't meet our needs.
According to
http://jira.jboss.com/jira/browse/JBAS-4037 the lib directory within an ear
should work as defined in the EE5 spec - Does that not include reflection? (Or is this a
bug?)
Thanks in advance for any help you can supply.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041998#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...