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.

ClassCastException during scan when classgraph is shaded

See original GitHub issue

This seems to be related to scanning modules but I don’t have any experience with them so I am at a bit of a loss of what the correct solution might entail. In a nutshell there are two orbit modules which shade classgraph to different packages, then when scanning a class cast exception is thrown as seen below.

Caused by: java.lang.ClassCastException: class cloud.orbit.runtime.shaded.io.github.classgraph.ModuleRef cannot be cast to class cloud.orbit.core.shaded.io.github.classgraph.ModuleRef (cloud.orbit.runtime.shaded.io.github.classgraph.ModuleRef and cloud.orbit.core.shaded.io.github.classgraph.ModuleRef are in unnamed module of loader 'app')
 at cloud.orbit.core.shaded.io.github.classgraph.Scanner.<init>(Scanner.java:169)
 at cloud.orbit.core.shaded.io.github.classgraph.ClassGraph.scanAsync(ClassGraph.java:1125)
 at cloud.orbit.core.shaded.io.github.classgraph.ClassGraph.scan(ClassGraph.java:1161)
 at cloud.orbit.core.shaded.io.github.classgraph.ClassGraph.scan(ClassGraph.java:1201)
 at cloud.orbit.core.shaded.io.github.classgraph.ClassGraph.scan(ClassGraph.java:1214)
 at cloud.orbit.actors.runtime.ClassPathSearch.<init>(ClassPathSearch.java:123)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
johnoucommented, Jun 20, 2019

@lukehutch sorry for the smoke, hope you don’t mind that I created a small wiki page in an effort to help others who may need to shade ClassGraph.

https://github.com/classgraph/classgraph/wiki/Shading-ClassGraph

0reactions
lukehutchcommented, Jun 20, 2019

Great, thanks for the contribution! I’ll link that page from the build instructions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ClassCastException during scanning (Java 11) - SonarQube
I encountered an error during scanning of my Java 11 source code. I created a snippet which recreates the same issue. Stuff I'm...
Read more >
ClassCastException because of different classloaders
Hello, In some place of my plugin I try to get class declared in a file by this way: class MyCustomTestContributor:...
Read more >
ClassGraph (ClassGraph 4.8.17 API) - javadoc.io
Uber-fast, ultra-lightweight Java classpath and module path scanner. Scans classfiles in the classpath and/or module path by parsing the classfile binary ...
Read more >
JRebel Changelog | JRebel & XRebel by Perforce
The JRebel Changelog shows the latest changes introduced in JRebel releases, ... Bug fix: fixed an integration issue when shaded Byte Buddy is...
Read more >
ClassCastException when trying to parse a JSONArray
class cast failures. Solution: Look at the web container file tree on your execution platform to find multiple copies of the JSON JAR...
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