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

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

Open
masa2146 opened this issue Feb 23, 2021 · 1 comment
Open
Labels
question Further information is requested

Comments

@masa2146
Copy link

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?

@aalmiray
Copy link
Contributor

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 aalmiray added the question Further information is requested label Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants