Error occurred during initialization of boot layer java.lang.module.ResolutionException: Module image.viewer contains package jcuda, module jcuda exports package jcuda to image.viewer

Im migrating my app from Java 1.8 to Java 11, I got the following error on Jcuda at runtime.

Error occurred during initialization of boot layer java.lang.module.ResolutionException: Module image.viewer contains package jcuda, module jcuda exports package jcuda to image.viewer

Here is my Module.info class

module image.viewer {

exports com.viewer;
exports com.viewer.backup;
exports com.viewer.backup.analyse;
exports com.viewer.compare;
exports com.viewer.controls;
exports com.viewer.database;
exports com.viewer.discovery;
exports com.viewer.events;
exports com.viewer.exif;
exports com.viewer.exportWorker;
exports com.viewer.external;
exports com.viewer.faceidentification;
exports com.viewer.gpuworker;
exports com.viewer.importers;
exports com.viewer.keypoints;
exports com.viewer.location;
exports com.viewer.model;
exports com.viewer.panes;
exports com.viewer.pool;
exports com.viewer.referenceDatabase;
exports com.viewer.registration;
exports com.viewer.renderers;
exports com.viewer.report;
exports com.viewer.search;
exports com.viewer.search.imfilters;
exports com.viewer.statistics;
exports com.viewer.surf;
exports com.viewer.tags;
exports com.viewer.thumbnail;
exports com.viewer.thumbnails;
exports com.viewer.util;
exports com.viewer.worker;
exports com.viewer.xmlWorker;

requires commons.dbcp;
requires ehcache;
requires eventbus;
requires transitive java.desktop;
requires java.sql;
requires java.activation;
requires java.xml;
requires java.xml.bind;
requires jna;
requires logback.classic;
requires logback.core;
requires lucene.core;
requires miglayout.swing;
requires slf4j.api;
requires snakeyaml;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires commons.io;
requires commons.lang3;
requires jdk.unsupported;
requires jgoodies.forms;
requires commons.collections4;
requires java.prefs;
requires jfreechart;
requires synthetica.base;
requires synthetica.theme.aluoxide;
requires synthetica.theme.blackeye;
requires synthetica.theme.dark;
requires synthetica.theme.plain;
requires WMI4Java;
requires jdk.security.auth;
requires commons.cli;
requires synthetica.addons.swingx;
requires synthetica.addons.base;
requires exiftool.lib;
requires javacsv;
requires poi;
requires poi.ooxml;
requires poi.scratchpad;
requires xmlbeans;
requires itextpdf;
requires mapsforge.core;
requires mapsforge.map;
requires mapsforge.map.awt;
requires mapsforge.map.reader;
requires opencv;
requires image.group.mk5;
requires image.face.age;
requires image.object;
requires image.zoning;
requires roi.detector;
requires rot.profile.age;
requires zt.zip;
requires webp.io;
requires opencsv;
requires psd.analizer;
requires xmlworker;
requires java.management;
requires jdk.management;
requires batik.dom;
requires batik.transcoder;
requires jackson.annotations;
requires org.glassfish.java.json;
requires gson;
requires OOXML;
requires image.jcuda;

opens com.viewer.model to snakeyaml, java.xml.bin;
}

Hello,

This does not seem to be directly related to JCuda, but seems to be a general question about the organizations of „modules“ and their package imports/exports in Java 11. I have to admit that until now, I only created one very basic („Hello World“) project with Java 11, and thus, I’m not really familiar with the module handling.

But maybe we can solve this anyhow.

My first question would be:

Which library contains the image.jcuda package?

It looks like someone might have created a library for image handling based on JCuda, but a quick websearch did not bring any results… except for this one: :wink:

I’m using eclipse and to migrate from 1.8 to 11 we have to create module.info.java file which contains all exports and requires.

In eclipse we can create that file automatically, by right click on project and under configuration there is an option called create module file.

Jcuda was giving me this exception so i create a separate child module name image.jcuda and placed all my code of Jcuda in that child module. I was hoping that it will not give me that error from child module.

now im calling function from that child module. but still same error occurred.

:joy::joy: good searching on stack

Again, sorry that I have to do some guesswork here (I should really have a closer look at the module system ASAP…). The guesswork involves websearching, of course, and something like https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000610370-JDK-9-error-Error-occurred-during-initialization-of-boot-layer-java-lang-module-ResolutionException-Module-deploy-contains-package-com-sun-deploy-uitoolkit-ui-module-plugin-legacy-exports-package-com-sun-deploy-uitoolkit-ui-to-deploy mentions an error message that is structurally the same as yours. So it looks like this may be caused by JAR files manually being added.

Can you provide more information about the project? For example: I assume this is a (pure) Maven project without manually added JARs, right?

(Creating a „minimal project where the problem can be reproduced“ could help, but admittedly, I haven’t even yet installed a fully-module-capable Eclipse version yet :flushed: )

No there is no Manual Jars in the project. The Project is big and on my small test it didnt give me this error, there is something which is missing.

Did you make jCuda modular? I think if we we add module.info into JCuda it will solve the issue.
Let me know if i can be any help in making JCuda Moduler

Well… admittedly, I have no idea how to investigate this systematically then. Some google-foo brought up the place where the exception comes from: https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java.base/share/classes/java/lang/module/Resolver.java#L712 but that probably does not help.

So the module-info that you posted is auto-generated?

I doubt that it will be necessary to add a module-info to JCuda (and I’d not even know where to place it really). What do you think should the contents of this module-info be?