layrry icon indicating copy to clipboard operation
layrry copied to clipboard

Error occurred during initialization of boot layer with module-info.java

Open masa2146 opened this issue 5 years ago • 1 comments

Hello, I want to add dynamically jars from a folder. And I created simple code and run but I get this error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/fatih/.m2/repository/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-impl-maven/3.1.4/shrinkwrap-resolver-impl-maven-3.1.4.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.jboss.shrinkwrap.resolver.spi.format.FileFormatProcessor not in module

I am using java 11 with module-info.class. My dependecies are:


<dependencies>
        <!-- https://mvnrepository.com/artifact/org.moditect.layrry/layrry-config -->
        <dependency>
            <groupId>org.moditect.layrry</groupId>
            <artifactId>layrry-config</artifactId>
            <version>1.0.0.Alpha1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.moditect.layrry/layrry-launcher -->
        <dependency>
            <groupId>org.moditect.layrry</groupId>
            <artifactId>layrry-launcher</artifactId>
            <version>1.0.0.Alpha1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.moditect.layrry/layrry-platform -->
        <dependency>
            <groupId>org.moditect.layrry</groupId>
            <artifactId>layrry-platform</artifactId>
            <version>1.0.0.Alpha1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.moditect.layrry/layrry-aggregator -->
        <dependency>
            <groupId>org.moditect.layrry</groupId>
            <artifactId>layrry-aggregator</artifactId>
            <version>1.0.0.Alpha1</version>
            <type>pom</type>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.moditect.layrry/layrry-config-yaml -->
        <dependency>
            <groupId>org.moditect.layrry</groupId>
            <artifactId>layrry-config-yaml</artifactId>
            <version>1.0.0.Alpha1</version>
        </dependency>
</dependencies>

And my test simple code is


public class TestMain {
    public static void main(String[] args) {
               Layers layers = Layers.builder()
//                .layer("deps")
//                .withModule("com.fasterxml.jackson.dataformat:jackson-databind:2.11.1")
//                .withModule("com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.11.1")
                .layer("commons")
                .withModulesIn(Paths.get(ParentFile.getParenFilePath() + "/plugins"))
                .build();
        layers.run("io.hubbox.test.App", "Fatih");

    }
}

But when I import these dependencies

        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-spi</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-spi-maven</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
            <version>3.1.4</version>
            <scope>test</scope>
        </dependency>

It'is working. Why do i need to import these dependencies? I want to import just your dependency.

And I cannot still add jars from folder on runtime. Could you help me?

masa2146 avatar Feb 23 '21 11:02 masa2146

A few things:

  • there is no need to add the layrry-aggregator dependency to your build.
  • if you want to use Layrry's API to create your own launcher then you need layrry-core, not layrry-launcher as a dependency.
  • the layrry-platform dependency goes on plugin projects, not on the project that used layrry-core to launch the application.
  • unfortunately the API exposed by layrry-core can't be used in a modular fashion because some of its dependencies are not modular and provide split packages (like the Shrinkwrap dependencies). this being said, the application and plugins can be modular but the launcher can't, at the moment.

Example Maven configuration for plugin based applications cat be found at

https://github.com/moditect/layrry-examples/tree/master/vertx-links https://github.com/moditect/layrry-examples/tree/master/modular-tiles

Please have a log at the pom files in those repositories and compare them with your setup.

aalmiray avatar Feb 23 '21 13:02 aalmiray