I have spended more than entire day on looking a way to get out of this situation.
Preamble
My goal is to deploy a Spring Boot application inside a EAR with other two already working modules. I have overcome many issues due the fact the Spring Boot application's POM have to be linked to the parent POM as the structure is the following:
/Parent POM
-----> EAR POM
-----> Module 1 POM
-----> Module 2 POM
-----> Spring Boot App POM
Problem
The Spring Boot application does the packaging as WAR correctly and is put inside the Ear successfully. The issue appears when this War is being loaded on JBoss as there are some dependecy issues.
What I have done
I played with jboss-deployment-structure.xml a bit and, at the end of the day, the result is this (restService is the spring boot application):
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
<!-- WFCORE-209 workaround -->
<module name="javaee.api" />
<module name="org.hibernate.validator"/>
<module name="javax.persistence.api" />
<module name="org.hibernate" />
<!--<module name="javax.validation"/>-->
</exclusions>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="datasources" />
<subsystem name="ejb3" />
<subsystem name="infinispan" />
<subsystem name="jca" />
<subsystem name="logging" />
<subsystem name="jdr" />
<subsystem name="jpa" />
<subsystem name="jsf" />
<subsystem name="mail" />
<subsystem name="threads" />
<subsystem name="pojo" />
<subsystem name="sar" />
<subsystem name="transactions" />
<subsystem name="webservices" />
<subsystem name="weld" />
</exclude-subsystems>
<dependencies>
<!-- WFCORE-209 workaround -->
<module name="javax.activation.api" export="true"/>
<module name="javax.annotation.api" export="true"/>
<module name="javax.ejb.api" export="true"/>
<module name="javax.el.api" export="true"/>
<module name="javax.enterprise.api" export="true"/>
<module name="javax.enterprise.deploy.api" export="true"/>
<module name="javax.inject.api" export="true"/>
<module name="javax.interceptor.api" export="true"/>
<module name="javax.jms.api" export="true"/>
<module name="javax.jws.api" export="true"/>
<module name="javax.mail.api" export="true"/>
<module name="javax.management.j2ee.api" export="true"/>
<!-- <module name="javax.persistence.api" export="true"/> -->
<module name="javax.resource.api" export="true"/>
<module name="javax.rmi.api" export="true"/>
<module name="javax.security.auth.message.api" export="true"/>
<module name="javax.security.jacc.api" export="true"/>
<module name="javax.servlet.api" export="true"/>
<module name="javax.servlet.jsp.api" export="true"/>
<module name="javax.transaction.api" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="javax.ws.rs.api" export="true" services="export"/>
<module name="javax.xml.bind.api" export="true"/>
<module name="javax.xml.registry.api" export="true"/>
<module name="javax.xml.soap.api" export="true"/>
<module name="javax.xml.ws.api" export="true"/>
<!-- This one always goes last. -->
<module name="javax.api" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="CRVbusinessService.war">
<dependencies>
<module name="javax.xml.rpc.api"/>
<module name="javax.wsdl4j.api"/>
</dependencies>
<exclusions>
<module name="org.apache.commons.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.logmanager.log4j"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
</exclusions>
</sub-deployment>
<sub-deployment name="restService.war">
<local-last value="true" />
<dependencies>
<module name="deployment.jpa2.1"/>
</dependencies>
<exclusions>
<module name="org.jboss.logging"/>
<!--<module name="javax.validation"/>-->
<module name="javaee.api" />
</exclusions>
</sub-deployment>
<module name="deployment.jpa2.1" >
<module-alias name="jpa2.1"/>
<resources>
<resource-root path="hibernate-jpa-2.1-api-1.0.0.Final.jar" />
</resources>
</module>
</jboss-deployment-structure>
However I wasn't able to sort out the problem as I am actually receiving this exception:
Application run failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.validation.Configuration.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
In order to provide further details here it is the Spring Boot app pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.test.businessService</groupId>
<artifactId>parent-parent</artifactId>
<version>0.0</version>
</parent>
<groupId>com.crvservice</groupId>
<artifactId>restService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<failOnMissingWebXml>false</failOnMissingWebXml>
<org.springframework-version>5.0.9.RELEASE</org.springframework-version>
<!--<hibernate.version>5.2.17.Final</hibernate.version>-->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>development</id>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
<profile>
<id>production</id>
<properties>
<spring.profiles.active>ci</spring.profiles.active>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
</profiles>
</project>
Adding <module name="javax.validation"/> in jboss-deployment-structure.xml seems not helping as it did with other similar issues that were fixed by adding the relative exclusion on Jboss. I fear that my Spring Boot version and on cascade of everything connected such as hibernate is too recent to function correctly on this JBoss version.
Am I missing something? I looked around, but it seems that few persons actually needed doing such things.
Thank you in advance.