Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] It is not possible to use jnosql with JPMS #457

Closed
m4ttek opened this issue Nov 26, 2023 · 8 comments
Closed

[BUG] It is not possible to use jnosql with JPMS #457

m4ttek opened this issue Nov 26, 2023 · 8 comments
Labels

Comments

@m4ttek
Copy link

m4ttek commented Nov 26, 2023

Which JNoSQL project the issue refers to?

JNoSQL (Core)

Bug description

It seems like the problem is caused by packages that are not unique in libraries dedicated to mapping. Automatic modules should be working without any hassle, but conflicts in packages create problems.

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/****/.m2/repository/org/eclipse/jnosql/mapping/jnosql-mapping-core/1.0.2/jnosql-mapping-core-1.0.2.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.eclipse.jnosql.mapping.reflection.collection.DequeSupplier not in JAR file jnosql-mapping-core-1.0.2.jar
[ERROR] Command execution failed.

What may fix it is that you should either add module-info to your libraries or restructure packages to be consistent with JPMS requirements. For example mapping-api-core should have classes within org.eclipse.jnosql.mapping.api package.

JNoSQL Version

1.0.2

Steps To Reproduce

  1. Create a project with module-info.java and any jnosql database dependency (and jakarta cdi).
  2. Define module-info.java file with following declarations:
    requires jnosql.mapping.reflection;
    requires jnosql.mapping.core;
    requires jnosql.mapping.api.core;
  1. Try to compile and run the code.

Expected Results

No response

Code example, screenshot, or link to a repository

No response

@m4ttek m4ttek added the bug label Nov 26, 2023
@otaviojava
Copy link
Member

Thank you @m4ttek we the new release that is the goal of this version.

@otaviojava
Copy link
Member

@m4ttek we refactored the code.
Could you check it?

@m4ttek
Copy link
Author

m4ttek commented Dec 10, 2023

@otaviojava I still get an error while packaging my app using modules:

Caused by: jdk.jpackage.internal.ConfigException: java.lang.module.FindException: Unable to derive module descriptor for /home/mkaminski/work/fuel-resolver/target/dependency/jnosql-mapping-core-1.0.4-SNAPSHOT.jar
	at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.validate(AppImageBundler.java:78)
	at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:689)
	... 31 more
Caused by: java.lang.module.FindException: Unable to derive module descriptor for /home/mkaminski/work/fuel-resolver/target/dependency/jnosql-mapping-core-1.0.4-SNAPSHOT.jar
	at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:648)
	at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:332)
	at java.base/jdk.internal.module.ModulePath.scanDirectory(ModulePath.java:285)
	at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:233)
	at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:191)
	at java.base/jdk.internal.module.ModulePath.find(ModulePath.java:155)
	at java.base/java.lang.module.ModuleFinder$2.lambda$find$0(ModuleFinder.java:351)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.AbstractList$RandomAccessSpliterator.tryAdvance(AbstractList.java:708)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at java.base/java.lang.module.ModuleFinder$2.find(ModuleFinder.java:353)
	at jdk.jpackage/jdk.jpackage.internal.LauncherData.createModular(LauncherData.java:145)
	at jdk.jpackage/jdk.jpackage.internal.LauncherData.create(LauncherData.java:121)
	at jdk.jpackage/jdk.jpackage.internal.StandardBundlerParam.lambda$static$0(StandardBundlerParam.java:86)
	at jdk.jpackage/jdk.jpackage.internal.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:114)
	at jdk.jpackage/jdk.jpackage.internal.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:88)
	at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.validate(AppImageBundler.java:68)
	... 32 more
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.eclipse.jnosql.mapping.reflection.collection.DequeSupplier not in JAR file jnosql-mapping-core-1.0.4-SNAPSHOT.jar
	at java.base/jdk.internal.module.ModulePath.deriveModuleDescriptor(ModulePath.java:555)
	at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:644)
	... 54 more

In addition, to run it in Intellij I need to add run options:

--add-reads
org.eclipse.jnosql.communication.document=weld.core.impl
--add-reads
org.eclipse.jnosql.communication.document=weld.api

@otaviojava
Copy link
Member

I will check it, but it is not in the core, but in the reflection module.

Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.eclipse.jnosql.mapping.reflection.collection.DequeSupplier not in JAR file jnosql-mapping-core-1.0.4-SNAPSHOT.jar
	at java.base/jdk.internal.module.ModulePath.deriveModuleDescriptor(ModulePath.java:555)
	at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:644)
	... 54 more

@otaviojava
Copy link
Member

@m4ttek could you check it in the newest version, 1.1.0
I believe that we fixed this point on this version.

@m4ttek
Copy link
Author

m4ttek commented Feb 12, 2024

@otaviojava ok, I'll try to check it, but I'll need to refactor some code as I resigned from JPMS due to these problems

@m4ttek
Copy link
Author

m4ttek commented Feb 13, 2024

I've checked bumping jnosql-arangodb to 1.1.0 in one of my projects and it work great, but I had to change imports for Page and Pageable interfaces ;)

@otaviojava
Copy link
Member

I've checked bumping jnosql-arangodb to 1.1.0 in one of my projects and it work great, but I had to change imports for Page and Pageable interfaces ;)

It happens because Jakarta Data broke the contract.
Thanks. I will update this ticket to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants