No longer compatible with JRE 1.5

284 views
Skip to first unread message

Chris Dolan

unread,
Aug 30, 2010, 12:10:54 PM8/30/10
to testng-users
I have a project that runs under a 1.5 JVM. After a recent Eclipse
update (including switching to TestNG 5.13.0.6) all tests fail with
the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: java/io/
Console
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)

The root cause appears to be that JCommander uses java.io.Console,
which was first introduced in Java 1.6. So, it appears that TestNG is
no longer compatible with Java 1.5. Is this an intentional change, or
inadvertent? Would it be feasible to restore 1.5 compatibility, or is
there a workaround?

Cédric Beust ♔

unread,
Aug 30, 2010, 12:52:12 PM8/30/10
to testng...@googlegroups.com
Hi Chris,

Yes, I'm aware of that, I didn't realize that java.io.Console was 1.6 only when I added it to JCommander.

I don't have a workaround yet, still thinking about how I could handle this.

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


vinay sambyal

unread,
Aug 30, 2010, 3:19:49 PM8/30/10
to testng...@googlegroups.com
Not sure if setting the system variable for JRE version and then in code if 1.5 then put a code that will do equivalent part of Console API or something similar to that.
 
But again I am not sure how much Console API is being used in JCommander.
 
Regards,
-Vinay

2010/8/30 Cédric Beust ♔ <ced...@beust.com>

Chris Dolan

unread,
Aug 30, 2010, 3:25:49 PM8/30/10
to testng-users
Thanks for looking at this. It might also explain some of the Mac OS
X 10.5 errors people have reported recently with TestNG, since Mac
only got JRE 1.6 with OS 10.6.

It looks to me like Console is only used for password entry in
JCommander. Here's a workaround strategy I've used in the past:
* move the bit of code that uses Console into its own helper class
* put a try/catch around the instantiation of that helper in
JCommander.parseValues where the catch includes NoClassDefFoundError
* scream bloody murder in that catch block

That way code that doesn't need password support will work in 1.5,
whereas you need 1.6 to get password support.

Chris


On Aug 30, 11:52 am, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi Chris,
>
> Yes, I'm aware of that, I didn't realize that java.io.Console was 1.6 only
> when I added it to JCommander.
>
> I don't have a workaround yet, still thinking about how I could handle this.
>
> --
> Cédric
>
>
>
> On Mon, Aug 30, 2010 at 9:10 AM, Chris Dolan <cjdo...@gmail.com> wrote:
> > I have a project that runs under a 1.5 JVM.  After a recent Eclipse
> > update (including switching to TestNG 5.13.0.6) all tests fail with
> > the following error:
>
> > Exception in thread "main" java.lang.NoClassDefFoundError: java/io/
> > Console
> >        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
>
> > The root cause appears to be that JCommander uses java.io.Console,
> > which was first introduced in Java 1.6.  So, it appears that TestNG is
> > no longer compatible with Java 1.5.  Is this an intentional change, or
> > inadvertent?  Would it be feasible to restore 1.5 compatibility, or is
> > there a workaround?
>
> --
> Cédric

Cédric Beust ♔

unread,
Sep 4, 2010, 11:20:02 AM9/4/10
to testng...@googlegroups.com
Hi Chris,

Yes, that's what I'm going to do (which means, no password support for Java 5). I just committed a version of JCommander that does that, I need to do some additional testing and I'll get back to you (you can test it directly from github if you want).

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


Barakka

unread,
Sep 6, 2010, 1:14:23 PM9/6/10
to testng-users
Hello,

we are also having this problem and it is basically blocking our use
of the eclipse plugin (btw, is there a way to download older versions
of the plugin?).

Do you already have a timeframe for the release of the fix? Just to
know if we have to wait just few more days, otherwise we'll need to
put more efforts in reverting to an older version of the plugin.

Thanks,
Riccardo.

On Sep 4, 5:20 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi Chris,
>
> > testng-users...@googlegroups.com<testng-users%2Bunsubscribe@google groups.com>
> > .

Cédric Beust ♔

unread,
Sep 6, 2010, 2:11:57 PM9/6/10
to testng...@googlegroups.com
Hi Riccardo,

I just released a Java 5 compatible version of JCommander, so I'll release an updated TestNG (5.14.1 probably) in the next few days. Let me know if it's not fast enough for you and we can work something out.

-- 
Cédric


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


Chris Dolan

unread,
Sep 6, 2010, 7:12:48 PM9/6/10
to testng-users
FYI: I successfully downgraded my Eclipse to 5.12 by first
uninstalling 5.14, quitting Eclipse, then downloading this:
http://testng.org/testng-eclipse-5.12.0.6.zip
and unpacking in the dropins folder as per these instructions:
http://code.google.com/p/testng/source/browse/trunk/doc/download.html?r=875
On restart Eclipse found 5.12 as expected and it works fine with JVM
1.5

Cédric, if it's a trivial amount of work, could you please list
multiple versions of the Eclipse plugin in your site.xml? Eclipse has
excellent support for choosing between multiple versions, but only if
the older versions are listed in the update site.

Chris

Barakka

unread,
Sep 7, 2010, 11:29:12 AM9/7/10
to testng-users
Thanks Cedric,

we can definitely live without it for a few more days. And if things
get ugly, we'll follow the suggestion from Chris (thanks, btw.).

Best,
Riccardo.

Cédric Beust ♔

unread,
Sep 8, 2010, 1:24:09 AM9/8/10
to testng...@googlegroups.com
Riccardo,

I just pushed a Java 5 compatible plug-in (5.14.1.0). Can you please update and confirm that it works for you?  (if it doesn't, contact me offline and we'll sort it out)

Thanks.

-- 
Cédric


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


Cédric Beust ♔

unread,
Sep 8, 2010, 1:26:11 AM9/8/10
to testng...@googlegroups.com
Hi Chris,

I'm not quite sure how I could generate a site that contains all the previous versions.

I do have binary versions of all the plug-ins and features that I published over the past few years, but I'm not sure how I am supposed to regenerate these at each update of the site (maybe I need to revert to a git/svn tag and rebuild each version? This looks tedious)

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


Jit Roy Chowdhury

unread,
Sep 9, 2010, 7:38:34 AM9/9/10
to testng-users
Hi,

I too downgraded to 5.12, and things started running smoothly. BTW,
the 5.14.1.0 plugin still did not work for me.

-- Jit
> Cédric- Hide quoted text -
>
> - Show quoted text -

traneHead

unread,
Sep 13, 2010, 3:59:58 AM9/13/10
to testng-users
To fix this, I opened the Run Configuration in Eclipse and changed the
JRE to 1.6 for my test class (the project is still on 1.5). This might
not be practical if there are lots of them, but it got my (few) tests
running again.

Cédric Beust ♔

unread,
Sep 13, 2010, 5:53:29 PM9/13/10
to testng...@googlegroups.com
Hi David,

In case you haven't followed, the latest TestNG Eclipse plug-in is now compatible with Java 5 again, please give it a try.

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


aldentaylor

unread,
Oct 8, 2010, 8:52:12 PM10/8/10
to testng-users
Hi,

I'm getting the same error after upgrading to 5.14.1

Exception in thread "main" java.lang.NoClassDefFoundError:
java.io.Console
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
Caused by: java.lang.ClassNotFoundException: java.io.Console
at java.net.URLClassLoader.findClass(URLClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:639)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:605)
... 4 more

I am using java.fullversion=J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32
j9vmwi3223-20091104 (JIT enabled)

This is while running an older version of the plugin with the latest
test-ng jar since the latest plugin version also did not work well
with this version of java.

org.testng.eclipse (5.14.0.1) "TestNG" [Active]

I am using -suitethreadpoolsize 3 option to thread suites.

++++++

When I upgraded to test-ng eclipse plugin org.testng.eclipse -
5.14.2.3 I got the following error while displaying the test view.

java.lang.UnsupportedClassVersionError: (org/testng/eclipse/ui/
TestRunnerViewPart) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:266)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:
183)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:
576)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:
546)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:
477)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:
465)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:
445)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:
211)
at
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:
381)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:
457)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:
410)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:
398)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:
105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:605)
at
org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:
326)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:
231)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:
1193)
at
org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:
160)
at
org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:
874)
at
org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:
243)
at
org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:
51)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:
267)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:
70)
at
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:
263)
at
org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:
63)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:
324)
at
org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:
226)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:
595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:
180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:
270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:
65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:
473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:
1256)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:
1209)
at
org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:
843)
at org.eclipse.ui.internal.PartStack.access$1(PartStack.java:829)
at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:139)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation
$1.handleEvent(TabbedStackPresentation.java:133)
at
org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:
270)
at
org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:
279)
at
org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access
$1(DefaultTabFolder.java:1)
at
org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder
$2.handleEvent(DefaultTabFolder.java:87)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:
3256)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:
323)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
3910)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:
332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:
149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:
113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:
194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

I'm hesitant to go to Java 6 because I'm using Rational Team Concert
and I'm frankly not sure what it will do w/o IBM's java 5. Also I do
not want to mandate that the rest of my team also upgrade.

Any help or ideas?

Thanks.

Cheers,
Alden

On Sep 13, 2:53 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi David,
>
> In case you haven't followed, the latest TestNG Eclipse plug-in is now
> compatible with Java 5 again, please give it a try.
>
> --
> Cédric
>
> On Mon, Sep 13, 2010 at 12:59 AM, traneHead <david.tisel...@gmail.com>wrote:
>
>
>
> > To fix this, I opened the Run Configuration in Eclipse and changed the
> > JRE to 1.6 for my test class (the project is still on 1.5). This might
> > not be practical if there are lots of them, but it got my (few) tests
> > running again.
>
> > On 30 Aug, 18:10, Chris Dolan <cjdo...@gmail.com> wrote:
> > > I have a project that runs under a 1.5 JVM.  After a recent Eclipse
> > > update (including switching to TestNG 5.13.0.6) all tests fail with
> > > the following error:
>
> > > Exception in thread "main" java.lang.NoClassDefFoundError:java/io/Console
> > >         at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
>
> > > The root cause appears to be that JCommander usesjava.io.Console,
> > > which was first introduced in Java 1.6.  So, it appears that TestNG is
> > > no longer compatible with Java 1.5.  Is this an intentional change, or
> > > inadvertent?  Would it be feasible to restore 1.5 compatibility, or is
> > > there a workaround?
>
> > --
> > 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<testng-users%2Bunsu...@googlegroups.com>
> > .

Cédric Beust ♔

unread,
Oct 8, 2010, 10:27:30 PM10/8/10
to testng...@googlegroups.com
Hi Alden,

Can you upgrade your plug-in again? I think I accidentally built the previous one with Java 6...

-- 
Cédric


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


aldentaylor

unread,
Oct 11, 2010, 2:52:52 PM10/11/10
to testng-users
Hi Cédric,

I upgraded to testng eclipse plugin 5.14.2.5 and still have the same
error.

java.lang.UnsupportedClassVersionError: (org/testng/eclipse/ui/
TestRunnerViewPart) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:266)

<snip>

If I revert the plugin I should still be able to run against
testng-5.14.1.jar and use the threaded suites right?

Cheers,
Alden

On Oct 8, 7:27 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi Alden,
>
> Can you upgrade your plug-in again? I think I accidentally built
> the previous one with Java 6...
>
> --
> Cédric
>
> ...
>
> read more »

Cédric Beust ♔

unread,
Oct 12, 2010, 6:54:56 PM10/12/10
to testng...@googlegroups.com
Alden, this should be fixed now, can you update your plug-in and let me know?

Thanks.

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


aldentaylor

unread,
Oct 15, 2010, 2:32:47 PM10/15/10
to testng-users
Awesome - works great. Thanks Cédric.

We are now running threads and multiple suites with 1 suite per thread
and seeing some significant performance improvements in our
integration tests.

Cheers,
Alden

On Oct 12, 3:54 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Alden, this should be fixed now, can you update your plug-in and let me
> know?
>
> Thanks.
>
> --
> Cédric
>
> ...
>
> read more »

Cédric Beust ♔

unread,
Oct 15, 2010, 2:42:10 PM10/15/10
to testng...@googlegroups.com

That's great to hear, thanks!

silv...@gmail.com

unread,
Jul 18, 2013, 12:52:59 PM7/18/13
to testng...@googlegroups.com, cjd...@gmail.com
On Eclipse Galileo (3.5), the problem occurs again with JRE 1.5 on TestNG 6.8.X, but it's fine with JRE 1.6 and TestNG 6.8.X
Working with JRE 1.5 and TestNG 6.0 is also fine

Is there a workaround in order to work with JRE 1.5 on Eclipse 3.5 with the latest version of TestNG ? 
I tried to replace the testng.jar in the Eclipse plugin with the latest version of TestNG and it's better (the tests runs) but no without error (Connection timed out, socket errors...).

Thanks :)
Reply all
Reply to author
Forward
0 new messages