[testng-users] No clear message error when running testng on mvn command line

1,024 views
Skip to first unread message

map3170013

unread,
Mar 25, 2011, 9:04:04 PM3/25/11
to testng...@googlegroups.com

Hello guys!

I have a multi module project set up on Maven with a parent pom and the
respectives pom's in each module itself. When running the goal "mvn install"
to run all the tests on testng.xml suite file and create the war file, I got
the following error:

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
java.lang.reflect.UndeclaredThrowableException
at $Proxy0.invoke(Unknown Source)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
... 4 more
Caused by: java.lang.ArrayStoreException:
sun.reflect.annotation.TypeNotPresentExceptionProxy
at
sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653)
at
sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460)
at
sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286)
at
sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
at
sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at
sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3077)
at java.lang.Class.getAnnotation(Class.java:3029)
at
org.testng.internal.annotations.JDK15TagFactory.findInheritedStringArray(JDK15TagFactory.java:373)
at
org.testng.internal.annotations.JDK15TagFactory.createTestTag(JDK15TagFactory.java:329)
at
org.testng.internal.annotations.JDK15TagFactory.createTag(JDK15TagFactory.java:46)
at
org.testng.internal.annotations.JDK15AnnotationFinder.findAnnotation(JDK15AnnotationFinder.java:111)
at
org.testng.internal.annotations.JDK15AnnotationFinder.findAnnotation(JDK15AnnotationFinder.java:77)
at
org.testng.internal.TestNGClassFinder.isTestNGClass(TestNGClassFinder.java:209)
at
org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:101)
at org.testng.TestRunner.initMethods(TestRunner.java:281)
at org.testng.TestRunner.init(TestRunner.java:227)
at org.testng.TestRunner.init(TestRunner.java:189)
at org.testng.TestRunner.<init>(TestRunner.java:138)
at
org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:477)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:244)
at org.testng.SuiteRunner.run(SuiteRunner.java:198)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
at org.testng.TestNG.run(TestNG.java:708)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:122)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:88)
at
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:104)
... 9 more

Basically these are the configurations I have:

pom.xml => parent module
...
<properties>
<webapp.name>sgp</webapp.name>
<testng.file>testng.xml</testng.file>
</properties>
...
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>
...

pom.xml => a child module
...
<suiteXmlFiles>
<suiteXmlFile>${testng.file}</suiteXmlFile>
</suiteXmlFiles>
...
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<classifier>jdk15</classifier>
</dependency>
...

I can't understand what happens because the error message is not clear for
me about I need to fix in order to run the tests. Is there anything wrong or
it's missing any config?

Please, If anybody has some idea, I really appreciate that.

Thanks
Pacheco
--
View this message in context: http://old.nabble.com/No-clear-message-error-when-running-testng-on-mvn-command-line-tp31243239p31243239.html
Sent from the testng-users mailing list archive at Nabble.com.

Cédric Beust ♔

unread,
Mar 25, 2011, 9:26:46 PM3/25/11
to testng...@googlegroups.com, map3170013
Hi Marco,

The exception:

sun.reflect.annotation.TypeNotPresentExceptionProxy

seems to indicate that an annotation in your class cannot be found at runtime, so maybe the testng.jar is not on Maven's compile class path.

Can you narrow this down to just one class and try to identify the annotation causing this? Then we can try to figure out why it can't be found.

-- 
Cédric



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


map3170013

unread,
Mar 25, 2011, 11:40:51 PM3/25/11
to testng...@googlegroups.com

Hi Cedric,

First of all, thank you very much for your answer.

By running the command to check the classpath dependencies on Maven, I could
see that the testng.jar is in the classpath. So, I guess this is not the
problem.

By running a single test like this

mvn -X -Dgroups=domain.MyRepositoryTest test

I have the same error and it's not possible to check other error messages.
Even the surefire-report pluging directory for Maven is empty, nothing has
been generated there after running the test.

Any other idea? Maybe, Am I forgetting to set up any thing?

Thanks again.
Marcelo

--
View this message in context: http://old.nabble.com/No-clear-message-error-when-running-testng-on-mvn-command-line-tp31243239p31243685.html

Cédric Beust ♔

unread,
Mar 25, 2011, 11:48:26 PM3/25/11
to testng...@googlegroups.com, map3170013
Can you cut down the number of classes and when you're down to one, start commenting out annotations?

-- 
Cédric

map3170013

unread,
Mar 26, 2011, 12:07:33 AM3/26/11
to testng...@googlegroups.com

This is my single class test, being called throughout command line:

mvn -Dgroups=domain.MyTest test

Notice that I've commented the only annotation on the source code and I got
the same error. By the way, that's the notation wich adds the test to my
personal testng group.

Thanks for your help!
Marcelo

---

package com.pack1.subpack.domain;

import com.pack1.subpack.test.EqualsHashCodeTester;

// @Test(groups = {"domain"})
public class MyTest {

private static final Class<MyTest> clazz = MyTest.class;

public void testEqualsAndHashcode() throws Exception {
EqualsHashCodeTester tester = new EqualsHashCodeTester(clazz,
"nome");
tester.test();
}

}

--
View this message in context: http://old.nabble.com/No-clear-message-error-when-running-testng-on-mvn-command-line-tp31243239p31243758.html

Cédric Beust ♔

unread,
Mar 26, 2011, 12:16:04 AM3/26/11
to testng...@googlegroups.com, map3170013
So you no longer have any TestNG annotations in your class and you're still seeing the error? Now I'm completely baffled...

There must be something wrong with your environment but I'm out of ideas...

-- 
Cédric

map3170013

unread,
Mar 26, 2011, 12:22:01 AM3/26/11
to testng...@googlegroups.com

Yeah, it's a bit weird for me, but I will double check everything and try it
over and over again.

At least I have the tests running correctly on Eclipse.

Anyway, thanks a lot!

Time to sleep in Brazil.. ZzZzZ
Marcelo

--
View this message in context: http://old.nabble.com/No-clear-message-error-when-running-testng-on-mvn-command-line-tp31243239p31243792.html

Reply all
Reply to author
Forward
0 new messages