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

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

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

Bernd Eckenfels edited comment on VFS-819 at 5/6/22 8:01 PM:
-------------------------------------------------------------

In a similar situation I got this problem due to the April Java update which introduced a JAR file mime type. You can remove it in your types.properties if it helps. In case this is the reason for your Problem a better handling of known file types is already in master, see my comment here: https://github.com/apache/commons-vfs/commit/f3b7a06f28aab2db829806e0e857c05b71a14305#comments

Alternatively you might be able to register the JARFileSystem with the new mimetype, that should also work.


was (Author: b.eckenfels):
In a similar situation I got this problem due to the April Java update which introduced a JAR file mime type. You can remove it in your types.properties if it helps. In case this is the reason for your Problem a better handling of known file types is already in master, see my comment here: https://github.com/apache/commons-vfs/commit/f3b7a06f28aab2db829806e0e857c05b71a14305#comments

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