I have written a Java 17 application that provides several MBeans. If I start the jar with a standard Java 17 SDK via java -jar myjar.jar
the applications starts and I can connect to it from JConsole.
Then I have created a custom runtime image with jlink.
The application itself runs fine with this image. It gets the MBeanServer and registers successfully my MBean.
When I start Jconsole I can select the running application (as "Local Process") but then the connection to this process can't be created.
I have tried to add a number of additional modules (like jdk.management, java.management, ...) but without success. It seems that at least one module is missing because in my customer runtime image eg the DLL management_ext.dll is missng.
Any idea which modules are necessary?
Try use jdeps
to check all modules are required in your build.
Example of listing all modules from .jar
jdeps --ignore-missing-deps --print-module-deps --multi-release 17 your-jar.jar
Example to jlink
jlink \
--module-path /path-with-all-jdk-modules \
--add-modules $(jdeps --ignore-missing-deps --print-module-deps --multi-release 17 your-jar.jar ) \
--output /path-output-jre-custom \
--strip-debug \
--no-header-files \
--no-man-pages \
--compress 2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.