When trying to register an MBean in JMX Console I'm getting the following error message:
The package javax.management is accessible from more than one module: <unnamed>, java.management
I'm using Eclipse and I have no module-info.java
file in my project structure.
The error disappear when I comment my dependency for Java EE API, but the javax.management
package is not part of the JAR.
I experienced similar issue when updating from java 8 to java 11. Steps below helped me,
Note: JRE System Library will remain under Modulepath.
Eclipse version: 2019-09
The best workaround with this is to locate the library that causes the duplication issue as it provides the same package than another module in the application. Just browse your project dependencies both JRE System Libraries and Project External Libraries, and examine packages within each library.
When you found that library, just exclude it from the build.
Say it is a library with this dependency signature:
group: 'lib.group', name: 'lib-name', version: notImportant
All you have to do is to exclude it from the build like this:
dependencies {
...
configurations {
compile.exclude group: 'lib.group', module: 'lib-name'
}
...
}
I answered to a similar question here ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With