eclipse / jnosql

Eclipse JNoSQL is a framework which has the goal to help Java developers to create Jakarta EE applications with NoSQL.
Other
231 stars 72 forks source link

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

Closed m4ttek closed 9 months ago

m4ttek commented 11 months ago

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;
  3. Try to compile and run the code.

Expected Results

No response

Code example, screenshot, or link to a repository

No response

otaviojava commented 11 months ago

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

otaviojava commented 11 months ago

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

m4ttek commented 11 months ago

@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 commented 11 months ago

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 commented 9 months ago

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

m4ttek commented 9 months ago

@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 commented 9 months ago

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 commented 9 months ago

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.