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.

module-info.java should contain "requires java.logging"

See original GitHub issue

Version 4.6.32

When I run new ClassGraph().verbose().scan() under IntellJ IDEA I get:

Exception in thread "main" java.lang.IllegalAccessError: class nonapi.io.github.classgraph.utils.LogNode (in module io.github.classgraph) cannot access class java.util.logging.Logger (in module java.logging) because module io.github.classgraph does not read module java.logging
	at io.github.classgraph@4.6.32/nonapi.io.github.classgraph.utils.LogNode.<clinit>(LogNode.java:51)
	at io.github.classgraph@4.6.32/io.github.classgraph.ClassGraph.verbose(ClassGraph.java:103)

I believe adding requires java.logging to your module-info.java file will fix this problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:37 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
cowwoccommented, Feb 10, 2019

I just verified the fix in master fixes the error in my application. Thank you!

1reaction
lukehutchcommented, Feb 10, 2019

I would say make it requires static java.logging - it is only needed when verbose is on

This is reasonable, but given that it is a java.util class, won’t it always be present in any JRE?

And actually, requires static is not ideal. From: https://blog.codefx.org/java/module-system-optional-dependencies/

As a consequence even if a module is present on the module path (or in the JDK for that matter), it will not be added to the module graph just because of an optional dependency. It will only make it into the graph if it is also a regular dependency of some other module that is being resolved or because it was added explicitly with the command line flag --add-modules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

package java.util.logging is not visible; Adding `requires java ...
I have a JPMS related issue. I am using JUL for my project and after doing a little google search I found out...
Read more >
1.2. Declare modules and enable access between modules
To declare an application module, a module declaration needs to be specified. This is done in a special file called module-info.java . As...
Read more >
Java Modules: a complete guide part 1 | by DV Singh - Medium
The module descriptor lives in a file called module-info.java. ... java.sql will now automatically be requiring java.logging and java.xml.
Read more >
Java 9 - Modules
The javac compiler will transform the module-info.java into a module-info.class file containing the information from the source file. The class ...
Read more >
Chapter 14. The Java Module System - Modern Java in Action
In the context of building software, requirements can change frequently. ... Alternatively, you could have written module-info.java as follows:.
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