New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.UnsupportedOperationException: newFileChannel #553
Comments
Hi, thanks for the report. I have never seen this, and I run on JDK 11+ all the time, so I don't know how to reproduce this. I was not aware of jrtfs previously, but it looks like it does not support I checked in a change to stop ClassGraph dying in this sort of situation. This change would prevent the above stacktrace from occurring, but it would also mean that Would you be able to produce a minimal test project please that shows the problem? |
Thanks Luke, I'll try to do it over the weekend. For now I can say that I run it from inside the Apache Spark shell (we develop a Spark driver extension), so perhaps this will give you a hint. |
Alright, this is what I have found so far. It has nothing to do with Spark, but Scala (Scala REPL to be precise). The error only occurs when the scanner is executed from inside a Scala REPL and only with Java 11 [wajda@alex-xps aaa]$ scala
Welcome to Scala 2.12.12 (OpenJDK 64-Bit Server VM, Java 11.0.12).
Type in expressions for evaluation. Or try :help.
scala> :require /home/wajda/.m2/repository/io/github/classgraph/classgraph/4.8.115/classgraph-4.8.115.jar
Added '/home/wajda/.m2/repository/io/github/classgraph/classgraph/4.8.115/classgraph-4.8.115.jar' to classpath.
scala> import io.github.classgraph.ClassGraph
import io.github.classgraph.ClassGraph
scala> new ClassGraph().enableClassInfo.scan().getAllClasses
io.github.classgraph.ClassGraphException: Uncaught exception during scan
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1558)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1575)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1588)
... 28 elided
Caused by: java.lang.UnsupportedOperationException: newFileChannel
at java.base/jdk.internal.jrtfs.JrtFileSystem.newFileChannel(JrtFileSystem.java:338)
at java.base/jdk.internal.jrtfs.JrtPath.newFileChannel(JrtPath.java:702)
at java.base/jdk.internal.jrtfs.JrtFileSystemProvider.newFileChannel(JrtFileSystemProvider.java:316)
at java.base/java.nio.channels.FileChannel.open(FileChannel.java:292)
at java.base/java.nio.channels.FileChannel.open(FileChannel.java:345)
at nonapi.io.github.classgraph.fileslice.PathSlice.<init>(PathSlice.java:118)
at nonapi.io.github.classgraph.fileslice.PathSlice.<init>(PathSlice.java:140)
at io.github.classgraph.ClasspathElementPathDir$1.openClassfile(ClasspathElementPathDir.java:253)
at io.github.classgraph.Classfile.<init>(Classfile.java:1925)
at io.github.classgraph.Scanner$ClassfileScannerWorkUnitProcessor.processWorkUnit(Scanner.java:734)
at io.github.classgraph.Scanner$ClassfileScannerWorkUnitProcessor.processWorkUnit(Scanner.java:657)
at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkLoop(WorkQueue.java:246)
at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkQueue(WorkQueue.java:161)
at io.github.classgraph.Scanner.processWorkUnits(Scanner.java:342)
at io.github.classgraph.Scanner.performScan(Scanner.java:970)
at io.github.classgraph.Scanner.openClasspathElementsThenScan(Scanner.java:1112)
at io.github.classgraph.Scanner.call(Scanner.java:1146)
at io.github.classgraph.Scanner.call(Scanner.java:83)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829) |
@wajda thanks for looking into this. Is there a way I can connect a remote debugger (Eclipse) to the REPL, to debug commands that are launched? I did a search for this but can't find good info. I need to figure out what is different about the REPL environment, and why. Are you launching your Spark jobs from the REPL? |
I've never debugged Scala REPL, but a quick google gave me this: scala -cp path/to/my/jar/some.jar -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9998 Spark jobs can be executed in different ways, e.g.: a) as a standalone Java app using Spark as a library, b) send to the Spark cluster via the The library (a Spark agent) that we develop is supposed to be included into the Spark driver classpath and support whatever execution way the user chooses, including REPL. |
Thanks for the pointer. With this info I was able to debug this. The JrtFS paths are of the form However, supposedly JrtFS was retrofitted all the way back to Java 1.8, but I don't know what it was used for on that version. I have only ever seen Otherwise, I'll work on ignoring this filesystem. |
This should be fixed in ClassGraph version 4.8.116 (just released). Please test with 4.8.115 with the Scala REPL on JDK 8, if you're able to do so easily. Otherwise, don't worry about it, it's probably not important, as ClassGraph auto-detects Thanks for the report, and for the helpful info on reproducing in Scala! Sorry that it took longer than my usual turnaround time to fix (I aim for 24 hours -- I have a lot going on right now!). |
Tested on Scala REPL 2.12 with several different JDK 1.8 - both v115 and v116 work. Confirm the issue fixed. |
Oops, I just remembered that you said in your original report that it worked fine in JDK 8 with 4.8.115. 😊 You're welcome, thank you for confirming! I'm glad the fix was simple in the end! |
When running under Java 1.8 it works great, but attempts to run it under Java 11 (tried different releases) it throws the following:
The text was updated successfully, but these errors were encountered: