question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scanning on LinuxKit doesn't work when scan root is not root directory of a jarfile

See original GitHub issue

https://github.com/lukehutch/fast-classpath-scanner/blob/c07698e2b7dea93b102b35f04f369bf5e911b789/src/main/java/io/github/lukehutch/fastclasspathscanner/scanner/RelativePath.java#L224

The line indicated is getting null from nestedJarHandler, when then is wrapped and throw as an IOException. This is preventing matching classes from being processed for a jar.

2018-01-23T18:52:34.862+0000    FastClasspathScanner    -- Searching for "Class-Path:" entries within manifest files
2018-01-23T18:52:34.874+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/localedata.jar
2018-01-23T18:52:34.874+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/sunjce_provider.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/sunpkcs11.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/cldrdata.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/zipfs.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/sunec.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/nashorn.jar
2018-01-23T18:52:34.877+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/jaccess.jar
2018-01-23T18:52:34.878+0000    FastClasspathScanner    ---- Ignoring JRE jar: /usr/java/jdk1.8.0_131/jre/lib/ext/dnsns.jar
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ---- Could not canonicalize path: /acceptance-1.22-SNAPSHOT.jar!/BOOT-INF/classes
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------ java.io.IOException: Exception while getting jarfile jar:file:/acceptance-1.22-SNAPSHOT.jar!/BOOT-INF/classes
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.RelativePath.getFile(RelativePath.java:223)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.RelativePath.exists(RelativePath.java:290)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.RelativePath.isValidClasspathElement(RelativePath.java:313)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.Scanner$1.processWorkUnit(Scanner.java:235)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.Scanner$1.processWorkUnit(Scanner.java:224)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.utils.WorkQueue.runWorkLoop(WorkQueue.java:182)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.utils.WorkQueue$1.call(WorkQueue.java:147)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.utils.WorkQueue$1.call(WorkQueue.java:144)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at java.lang.Thread.run(Thread.java:748)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------ Caused by: java.lang.NullPointerException
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  at io.github.lukehutch.fastclasspathscanner.scanner.RelativePath.getFile(RelativePath.java:208)
2018-01-23T18:52:34.880+0000    FastClasspathScanner    ------  ... 11 more

This has been seen using 2.9.5 or later releases. 2.9.4 is a version that does not have this problem.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:59 (29 by maintainers)

github_iconTop GitHub Comments

3reactions
lukehutchcommented, Jan 25, 2018

@ncoe Sure, that will do it. Although digging into this issue uncovered two other issues so far, so we’re making progress 😃

1reaction
ncoecommented, May 9, 2018

It looks like 2.21 is still working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scanning is slower in 2.12.0 · Issue #174 - GitHub
lukehutch mentioned this issue on May 3, 2018. Scanning on LinuxKit doesn't work when scan root is not root directory of a jarfile...
Read more >
Scan all unmanaged JAR files - Snyk User Docs
The Snyk CLI can scan unmanaged JAR files in Java applications to identify which open source package they contain. · The CLI identifies...
Read more >
Scan class or jar file in Java - Stack Overflow
From exmaple depot: How to load a Class that is not on the classpath: // Create a File object on the root of...
Read more >
Running Java From the Command Line - JHU CS
To run the checkstyle jar as an executable (note we don't need to compile ... Scanner in your code, you are basically telling...
Read more >
Java - Read a file from resources folder - Mkyong.com
Usually, the files in the resources folder will copy to the root of the classpath ... The getResource method is not working in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found