You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Christopher Tubbs (Jira)" <ji...@apache.org> on 2022/05/06 16:28:00 UTC

[jira] [Commented] (VFS-819) VFSClassLoader ClassNotFoundException JDK 17

    [ https://issues.apache.org/jira/browse/VFS-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17532966#comment-17532966 ] 

Christopher Tubbs commented on VFS-819:
---------------------------------------

These worked on JDK 17 until recently. It's not clear what changed. We noticed the failures occurred first in Temurin, then when we switched to Adoptium, it started occuring there a few weeks later. So, it seems like there may be a classloading behavior change upstream in Java that VFS is depending on.

> VFSClassLoader ClassNotFoundException JDK 17
> --------------------------------------------
>
>                 Key: VFS-819
>                 URL: https://issues.apache.org/jira/browse/VFS-819
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.9.0
>         Environment: OpenJDK 17 version "17.0.3" 2022-04-19
> Apache Maven 3.8.5
> Multiple Linux
>            Reporter: Mike Miller
>            Priority: Major
>
> We (Accumulo) are seeing the VFSClassLoader failing in JDK 17. We have very simple tests, that are all failing when trying to use it to load classes from the classpath.
> {noformat}
> [INFO] Running org.apache.accumulo.start.classloader.vfs.providers.VfsClassLoaderTest
> [ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 26.367 s <<< FAILURE! - in org.apache.accumulo.start.classloader.vfs.providers.VfsClassLoaderTest
> [ERROR] org.apache.accumulo.start.classloader.vfs.providers.VfsClassLoaderTest.testGetClass  Time elapsed: 0.02 s  <<< ERROR!
> java.lang.ClassNotFoundException: test.HelloWorld
>     at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:150)
>     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
>     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>     at org.apache.accumulo.start.classloader.vfs.providers.VfsClassLoaderTest.testGetClass(VfsClassLoaderTest.java:66)
> {noformat}
> Here is an example:
> {code:java}
> this.cl = new VFSClassLoader(dirContents, vfs);
> @Test
> public void testGetClass() throws Exception {
>   Class<?> helloWorldClass = this.cl.loadClass("test.HelloWorld");
>   Object o = helloWorldClass.getDeclaredConstructor().newInstance();
>   assertEquals("Hello World!", o.toString());
> }{code}
> https://github.com/apache/accumulo/blob/main/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java



--
This message was sent by Atlassian Jira
(v8.20.7#820007)