0

I'm trying to create a project using Thorntail and DeltaSpike. I created two different Maven projects.

  1. Web - this will have JSF and CDI.
  2. Core - This will have DeltaSpike data module, CDI and JPA.

here are the POM files:

  1. Core Project

    jar
    org.apache.deltaspike.distribution distributions-bom ${deltaspike.version} pom import io.thorntail bom ${version.thorntail} pom import

    <dependencies>
    
        <dependency>
          <groupId>io.thorntail</groupId>
          <artifactId>cdi</artifactId>
          <version>${version.thorntail}</version>
        </dependency>
        <dependency>
          <groupId>io.thorntail</groupId>
          <artifactId>jpa</artifactId>
          <version>${version.thorntail}</version>
        </dependency>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>datasources</artifactId>
            <version>${version.thorntail}</version>
        </dependency>       
        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-data-module-api</artifactId>
            <version>${deltaspike.version}</version>
            <scope>compile</scope>
        </dependency>       
        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-data-module-impl</artifactId>
            <version>${deltaspike.version}</version>
            <scope>runtime</scope>
        </dependency>
    
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.192</version>
        </dependency>
    
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>compile</scope>
        </dependency>
         <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>arquillian</artifactId>
            <scope>test</scope>
         </dependency>
        <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>24.0-jre</version>
                 <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>core</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
  2. Web Project

    war 1.9.1 2.5.0.Final

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>test.core</groupId>
            <artifactId>core</artifactId>
            <version>0.0.1-SNAPSHOT</version>           
        </dependency>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>jsf</artifactId>
            <version>${version.thorntail}</version>
        </dependency>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>cdi</artifactId>
            <version>${version.thorntail}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>web</finalName>
        <plugins>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>           
            <plugin>
                <groupId>io.thorntail</groupId>
                <artifactId>thorntail-maven-plugin</artifactId>
                <version>${version.thorntail}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

I create the entityManagerProducer and I have a persistence.xml and I created the project-defaults.yml in the main/resources of the core project.

But I keep getting the following error:

2019-10-21 09:04:47,733 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."web.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."web.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1730)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type DatasourcesFraction with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject org.wildfly.swarm.datasources.runtime.DatasourceAndDriverCustomizer.fraction
  at org.wildfly.swarm.datasources.runtime.DatasourceAndDriverCustomizer.fraction(DatasourceAndDriverCustomizer.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:290)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:143)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:526)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:64)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Rabbit
  • 152
  • 2
  • 11

1 Answers1

1

The one Maven module that uses the Thorntail Maven plugin to generate the uberjar needs to know about all the Thorntail fractions that are used. One would expect that the fractions would be brought in transitively from the core dependency, but I think that doesn't really work. You either have to declare all the fractions as dependencies in the web module, or you can list them in the <fractions> configuration property of the Thorntail Maven plugin.

Ladicek
  • 5,970
  • 17
  • 20
  • I think it brings the fraction in a transitively. See the output bellow when I start: **THORN0013: Installed fraction:JPA - STABLE io.thorntail:jpa:2.5.0.Final.** I change the locations of the beans.xml files and now I get **Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named ' '** It seems that the core project is unable to find the persistence.xml file. – Rabbit Oct 21 '19 at 08:10
  • I added the **thorntail maven plugin** in the core project. So I can start the uberjar. After starting the uberjar It can start the persistence unit. **Starting Persistence Unit (phase 2 of 2) Service**. But I get a different problem **WELD-000119: Not generating any bean definitions from .. org.apache.deltaspike.data.api.EntityRepository not found. If this is unexpected, enable DEBUG logging to see the full error** Any help!? – Rabbit Oct 21 '19 at 08:56
  • If this answer solves the question, I would suggest accepting it and posting the problem about WELD-000119 in a new question. – Nikos Paraskevopoulos Oct 21 '19 at 09:09
  • Unfortunately the answer did not solve the problem. I'm just trying to give more data about the problem. – Rabbit Oct 21 '19 at 09:16
  • I would still suggest to keep all the Thorntail bits in a single Maven module. Putting the Thorntail Maven plugin into 2 Maven modules and generating 2 uberjars won't help. I also noticed that you have `project-defaults.yml` in the `core` project -- that definitely won't work, the configuration will be ignored. That needs to be in the "top-level" Maven module -- the one that generates the uberjar. – Ladicek Oct 21 '19 at 12:15
  • @Ladicek putting all fractions in the top-level project give me access in the web project to the **JPA, deltaspike and all other dependencies that I only need at the core project**. Is there any way to create this separation using **Thorntail and maven** !? – Rabbit Oct 21 '19 at 20:16
  • As I said, you can use the `` configuration property of the Thorntail Maven plugin. In such case, you don't have to add dependency on Thorntail fractions to any project, it's enough to add dependency on the Java EE specification APIs. – Ladicek Oct 22 '19 at 07:06