Eclipse Plug-In - Execution of a testcase: java.lang.UnsupportedClassVersionError:

340 views
Skip to first unread message

Tom Hain

unread,
Sep 20, 2007, 10:50:38 AM9/20/07
to testng...@googlegroups.com

Whenever I try to execute a Testsuite (testng.xml) in Eclipse 3.3 via 'Run as
TestNG Suite' I'll get the following error:

java.lang.UnsupportedClassVersionError: org/testng/remote/RemoteTestNG
(Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
.....


I use JDK 1.4.2_14 and testng-5.6-jdk14.jar.


The testng.xml look like this:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="TestSuite" verbose="1">

<test name="Test - 1">

<parameter name="param1" value="2" />
<parameter name="param2" value="1234" />
<parameter name="param3" value="10000" />
<parameter name="param4" value="2000077387" />
<parameter name="param5" value="3" />
<parameter name="param6" value="10928" />
<parameter name="param7" value="-10000" />
<parameter name="param8" value="10000" />
<parameter name="param9" value="-10000" />

<classes>
<class
name="test.end2end.Test" />
</classes>
</test>

</suite>


Does anybody knows why this happens?

Thanks,

Tom

--
View this message in context: http://www.nabble.com/Eclipse-Plug-In---Execution-of-a-testcase%3A-java.lang.UnsupportedClassVersionError%3A-tf4488004.html#a12798706
Sent from the testng-users mailing list archive at Nabble.com.

borojevic

unread,
Sep 21, 2007, 4:23:49 AM9/21/07
to testng-users
On the project properties dialog select TestNG, then make sure that
"User project TestNG jar" is checked.
Of course testng.jar must be for jdk 1.4.

> View this message in context:http://www.nabble.com/Eclipse-Plug-In---Execution-of-a-testcase%3A-ja...

Alexandru Popescu ☀

unread,
Sep 21, 2007, 5:15:40 AM9/21/07
to testng...@googlegroups.com
On 9/21/07, borojevic <boro...@gmail.com> wrote:
>
> On the project properties dialog select TestNG, then make sure that
> "User project TestNG jar" is checked.
> Of course testng.jar must be for jdk 1.4.
>

Well, I am not sure this will solve the problem. TestNG plugin is
deciding which internal testng jar to use according to the project
runtime settings (so if the VM is >= 1.5 it will use the
testng-jdk15.jar, otherwiser testng-jdk14.jar). However, this
configuration cannot lead to the above exception as the VM will be
compatible with the chosen jar.

So, I assume there is some weird thing going on. I would try to clean
up the project, double check the classpath, double check the TestNG
plugin settings.

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

Tom Hain

unread,
Sep 21, 2007, 5:41:46 AM9/21/07
to testng...@googlegroups.com

It works after enabling "User project TestNG jar" in the project settings !!
Thanks you very much!
Somehow, I have overseen this flag.. Thanks!

--
View this message in context: http://www.nabble.com/Eclipse-Plug-In---Execution-of-a-testcase%3A-java.lang.UnsupportedClassVersionError%3A-tf4488004.html#a12813801

borojevic

unread,
Sep 21, 2007, 6:01:29 AM9/21/07
to testng-users
I just looked better at this problem.
The thing is that checking the box on the project settings "Use
project TestNG.jar" will tell plugin
to use testng.jar for jdk14, but there is also another option.
On run dialog in eclipse, in runtime section there is an option to
choose Annnotations compliance level.
By default it is JDK, you just need to change this to javadoc and it
will work fine also!

> View this message in context:http://www.nabble.com/Eclipse-Plug-In---Execution-of-a-testcase%3A-ja...

Tom Hain

unread,
Sep 26, 2007, 6:23:45 AM9/26/07
to testng...@googlegroups.com

I checked the different options and I observed the following:
It seems to be a must to set both: Project properties "Use project Testng
jar" and in the run dialog the annotations compliance level needs to be set
to "javadoc" in case of jdk 1.4.

Running the test without having the compliance level set to "javadoc"
results in this message:

[TestNGClassFinder] SKIPPING CLASS class test.end2end.TestNgClazz no TestNG
annotations found

Running the test without having set the project properties ends up with this
message:

java.lang.NoSuchMethodError:
java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
at
org.testng.remote.strprotocol.MessageHelper.replaceUnicodeCharactersWithAscii(MessageHelper.java:149)
...

In case both settings are enabled it works fine.

--
View this message in context: http://www.nabble.com/Eclipse-Plug-In---Execution-of-a-testcase%3A-java.lang.UnsupportedClassVersionError%3A-tf4488004.html#a12898009

Alexandru Popescu ☀

unread,
Sep 26, 2007, 8:32:51 AM9/26/07
to testng...@googlegroups.com
On 9/26/07, Tom Hain <thorste...@db.com> wrote:
>
>
> I checked the different options and I observed the following:
> It seems to be a must to set both: Project properties "Use project Testng
> jar" and in the run dialog the annotations compliance level needs to be set
> to "javadoc" in case of jdk 1.4.
>
> Running the test without having the compliance level set to "javadoc"
> results in this message:
>
> [TestNGClassFinder] SKIPPING CLASS class test.end2end.TestNgClazz no TestNG
> annotations found
>
> Running the test without having set the project properties ends up with this
> message:
>
> java.lang.NoSuchMethodError:
> java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
> at
> org.testng.remote.strprotocol.MessageHelper.replaceUnicodeCharactersWithAscii(MessageHelper.java:149)
> ...
>

I think this last one may be a bug introduced lately. I will check it
and report back.

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

> In case both settings are enabled it works fine.

Alexandru Popescu ☀

unread,
Oct 2, 2007, 6:52:57 AM10/2/07
to testng...@googlegroups.com
This has been fixed in trunk (source MessageHelper) r514.

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

Reply all
Reply to author
Forward
0 new messages