Sponsor Request: Running jtreg plugin can fail with NoClassDefFoundError: com/beust/jcommander/ParameterException

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Apr 1 16:48:36 UTC 2020


I think it's more version dependent and/or where you get TestNG from.  
It used to be co-bundled; my recollection is that that is no longer the 
case.

-- Jon

On 4/1/20 9:30 AM, Maurizio Cimadamore wrote:
> I don't have jcommander.jar in my jtreg/lib folder.
>
> Jon, do you know if the list of bundled libraries changes on a 
> per-platform basis?
>
> Thanks
> Maurizio
>
> On 01/04/2020 14:34, Jorn Vernee wrote:
>> Hi,
>>
>> When running a jtreg run configuration with the intellij jtreg plugin 
>> I am running into:
>>
>> java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
>>     at 
>> com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:87)
>>     at 
>> com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
>>     at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>>     at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>     at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>>     at 
>> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
>>     at java.base/java.lang.Thread.run(Thread.java:832)
>> Caused by: java.lang.ClassNotFoundException: 
>> com.beust.jcommander.ParameterException
>>     at 
>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
>>     at 
>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>>     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>>     ... 8 more
>>
>> It looks like the jcommander jar is missing from the runtime class 
>> path. Following change fixes it for me [1]. I've also added the jcov 
>> jars just in case, since they ship with jtreg, and might also be 
>> needed at some point, though the particular problem I'm seeing is 
>> fixed if I only add the jcommander jar.
>>
>> Thanks,
>> Jorn
>>
>> [1]:
>>
>> diff --git 
>> a/plugins/idea/src/com/oracle/plugin/jtreg/configuration/JTRegConfigurationRunnableState.java 
>> b/plugins/idea/src/com/oracle/plugin/jtreg/configuration/JTRegConfigurationRunnableState.java 
>>
>> index d79f503..a813ac9 100644
>> --- 
>> a/plugins/idea/src/com/oracle/plugin/jtreg/configuration/JTRegConfigurationRunnableState.java
>> +++ 
>> b/plugins/idea/src/com/oracle/plugin/jtreg/configuration/JTRegConfigurationRunnableState.java
>> @@ -158,6 +158,9 @@ class JTRegConfigurationRunnableState extends 
>> JavaTestFrameworkRunnableState<JTR
>> javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/testng.jar");
>> javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/junit.jar");
>> javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/asmtools.jar");
>> + javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/jcommander.jar");
>> + javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/jcov.jar");
>> + javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + 
>> "/lib/jcov_network_saver.jar");
>>      }
>>
>>      protected void configureRTClasspath(JavaParameters 
>> javaParameters, Module module) throws CantRunException {
>>


More information about the ide-support-dev mailing list