RFR(S): JDK-8165500: TestJpsJar shouldn't jar all test.classpath directories

Dmitry Dmitriev dmitry.dmitriev at oracle.com
Thu Sep 15 12:34:07 UTC 2016


Hi Dmitry,

I don't think that this solves the problem. If some test build 
testlibrary before TestJpsJar.java, then testlibrary classes will be 
outside the folder with JpsHelper class and thus missed in the jar file.

I can reproduce this problem with your patch applied:
1) Run sun/tools/jinfo/BasicJInfoTest.java in clean folder
2) Then run sun/tools/jps/TestJpsJar.java. TestJpsJar.java fails with 
following error:
stderr: [Exception in thread "main" java.lang.NoClassDefFoundError: 
jdk/testlibrary/ProcessTools
         at JpsBase.main(JpsBase.java:73)
Caused by: java.lang.ClassNotFoundException: jdk.testlibrary.ProcessTools
         at 
jdk.internal.loader.BuiltinClassLoader.loadClass(java.base at 9-internal/BuiltinClassLoader.java:366)
         at 
jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base at 9-internal/ClassLoaders.java:185)
         at 
java.lang.ClassLoader.loadClass(java.base at 9-internal/ClassLoader.java:424)
         ... 1 more
]
  exitValue = 1

java.lang.RuntimeException: Expected to get exit value of [0]

Thanks,
Dmitry

On 15.09.2016 15:18, Dmitry Samersoff wrote:
> Everybody,
>
> Please, review the small fix.
>
> http://cr.openjdk.java.net/~dsamersoff/JDK-8165500/webrev.01/
>
> The problem:
>
> TestJpsJar attempts to copy all directories found in test.class.path
> into a single jar file.
>
> It's not necessary and could lead to intermittent ClassNotFound exceptions.
>
> Solution:
>
> Jar only a directory with required files.
>
> -Dmitry
>
>



More information about the serviceability-dev mailing list