Maven : Strange ClassNotFoundException of Primefaces library on deploy - maven

I have an enterprise application with an ejb and two war, the problem is that when I use one of the JSF on an war I encounter a strange ClassNotFoundException on deployment. The maven compilation goes well, and the two web applications will also work.
Here a sample of the long logging on the Glassfish 3.1.1 server :
ATTENTION: WEB9052: Unable to load class org.primefaces.component.growl.Growl, reason: java.lang.ClassNotFoundException: org.primefaces.component.growl.Growl
ATTENTION: WEB9052: Unable to load class org.primefaces.component.menuitem.MenuItem, reason: java.lang.ClassNotFoundException: org.primefaces.component.menuitem.MenuItem
ATTENTION: WEB9052: Unable to load class org.primefaces.component.poll.Poll, reason: java.lang.ClassNotFoundException: org.primefaces.component.poll.Poll
ATTENTION: WEB9052: Unable to load class org.primefaces.component.commandbutton.CommandButton, reason: java.lang.ClassNotFoundException: org.primefaces.component.commandbutton.CommandButton
ATTENTION: WEB9052: Unable to load class org.primefaces.component.outputpanel.OutputPanel, reason: java.lang.ClassNotFoundException: org.primefaces.component.outputpanel.OutputPanel
ATTENTION: WEB9052: Unable to load class org.primefaces.component.fieldset.Fieldset, reason: java.lang.ClassNotFoundException: org.primefaces.component.fieldset.Fieldset
ATTENTION: WEB9052: Unable to load class org.primefaces.component.chart.bar.BarChart, reason: java.lang.ClassNotFoundException: org.primefaces.component.chart.bar.BarChart
ATTENTION: WEB9052: Unable to load class org.primefaces.component.selectmanymenu.SelectManyMenu, reason: java.lang.ClassNotFoundException: org.primefaces.component.selectmanymenu.SelectManyMenu
ATTENTION: WEB9052: Unable to load class org.primefaces.component.separator.Separator, reason: java.lang.ClassNotFoundException: org.primefaces.component.separator.Separator
ATTENTION: WEB9052: Unable to load class org.primefaces.component.watermark.Watermark, reason: java.lang.ClassNotFoundException: org.primefaces.component.watermark.Watermark
Here is the hierarchy of the application :
|--MavenDemo
|-MavenDemo-ear
|---src
|-----main
|-------application
|---------META-INF
|-MavenDemo-ejb
|---src
|-----main
|-------java
|-------resources
|---------META-INF
|-MavenDemo-web
|---src
|-----main
|-------java
|-------webapp
|-MavenDemo-web2
|---src
|-----main
|-------java
|-------webapp
And here the pom.xml files of modules:
POM of the project :
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MavenDemo</name>
<modules>
<module>MavenDemo-ear</module>
<module>MavenDemo-ejb</module>
<module>MavenDemo-web</module>
<module>MavenDemo-web2</module>
</modules>
</project>
POM of the EAR module :
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>MavenDemo</artifactId>
<groupId>fr.momsse</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>MavenDemo-ear</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-web2</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
</project>
POM of the EJB module :
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>MavenDemo</artifactId>
<groupId>fr.momsse</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ejb</packaging>
<name>MavenDemo-ejb</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
POM of the first WAR module who uses Primefaces :
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>MavenDemo</artifactId>
<groupId>fr.momsse</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MavenDemo-web</name>
<!-- ......................................... -->
<!-- .............. Repositories ............. -->
<!-- ......................................... -->
<repositories>
<repository>
<url>http://repository.primefaces.org/</url>
<id>primefaces</id>
<layout>default</layout>
<name>Repository for library Library[primefaces]</name>
</repository>
</repositories>
<dependencies>
<!-- ............................................. -->
<!-- ..... Java EE 6 Web API, JSTL & Taglibs ..... -->
<!-- ............................................. -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- ......................................... -->
<!-- .......... Java Server Faces ............ -->
<!-- ......................................... -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.1-b04</version>
<scope>provided</scope>
</dependency>
<!-- ......................................... -->
<!-- .............. Primefaces ............... -->
<!-- ......................................... -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
POM of the second WAR module :
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>MavenDemo</artifactId>
<groupId>fr.momsse</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>fr.momsse</groupId>
<artifactId>MavenDemo-web2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MavenDemo-web2</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thanks in advance for your precious helps.

Related

Maven : get version from dependency of the present dependency

I have a pom.xml that contains some projects
<groupId>org.company</groupId>
<artifactId>aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.company</groupId>
<artifactId>project-one</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.company</groupId>
<artifactId>project-two</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
Now, i initialized an other project and its pom.xml as below
<dependencies>
<dependency>
<groupId>org.company</groupId>
<artifactId>aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>iterator-maven-plugin</artifactId>
<version>${maven-iterator.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>iterator</goal>
</goals>
<configuration>
<items>
<item>project-one</item>
<item>project-two</item>
</items>
<pluginExecutors>
<pluginExecutor>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<goal>copy</goal>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.company</groupId>
<artifactId>#item#</artifactId>
<version>???</version> <!-- I need to specify the version that is in the aggregator pom.xml -->
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/Directory/#item#</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</pluginExecutor>
</pluginExecutors>
</configuration>
</execution>
</executions>
</plugin>
I tried to remove the field and I thought maven would look for the version specified in the dependency for exemple :
project-one.1.0.0-SNAPSHOT
project-two.1.0.2-SNAPSHOT
but it didn't work.
Is there a way to handle versions through dependencies ?
Thanks

java.lang.ClassCastException deploying CAS 5.3.3 Maven Overlay WAR on Wildfly 10

I'm deploying CAS 5.3.3 on Wildfly 10, using a Maven Overlay as specified in https://apereo.github.io/cas/5.3.x/installation/Maven-Overlay-Installation.html and using the project template at: https://github.com/apereo/cas-overlay-template/tree/5.3
After deploying to Wildfly 10, deploy fails with the following exception:
09:02:06,982 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 70) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./cas: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./cas: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
The problem may be related to Spring Boot Maven configuration. However, I have tried these solutions, but they are not working:
Spring Boot Websockets in Wildfly
WildFly 10 Spring Boot war Deployment Error
org.apache.tomcat.websocket.WsWebSocketContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
It may be related also to:
https://groups.google.com/a/apereo.org/forum/#!topic/cas-user/Buzbh5XpnlI
https://docs.spring.io/spring-boot/docs/1.5.14.RELEASE/reference/htmlsingle/#howto-create-a-deployable-war-file
Edit: This is my POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-overlay</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>com.rimerosolutions.maven.plugins</groupId>
<artifactId>wrapper-maven-plugin</artifactId>
<version>0.0.5</version>
<configuration>
<verifyDownload>true</verifyDownload>
<checksumAlgorithm>MD5</checksumAlgorithm>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
<addResources>true</addResources>
<executable>${isExecutable}</executable>
<layout>WAR</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warName>cas</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
<recompressZippedFiles>false</recompressZippedFiles>
<archive>
<compress>false</compress>
<manifestFile>${manifestFileToUse}</manifestFile>
</archive>
<overlays>
<overlay>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp${app.server}</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
</plugins>
<finalName>cas</finalName>
</build>
<properties>
<cas.version>5.3.3</cas.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
<!-- No ponemos ninguno, para desplegar en WildFly 10 -->
<app.server></app.server>
<mainClassName>org.springframework.boot.loader.WarLauncher</mainClassName>
<isExecutable>false</isExecutable>
<manifestFileToUse>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF</manifestFileToUse>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>default</id>
<dependencies>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp${app.server}</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<!--
...Additional dependencies may be placed here...
-->
<!--
For Wildfly deployment
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
<profile>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<id>exec</id>
<properties>
<mainClassName>org.apereo.cas.web.CasWebApplication</mainClassName>
<isExecutable>true</isExecutable>
<manifestFileToUse></manifestFileToUse>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>0.3.0</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>echo</goal>
</goals>
</execution>
</executions>
<configuration>
<echos>
<echo>Executable profile to make the generated CAS web application executable.</echo>
</echos>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<id>bootiful</id>
<properties>
<app.server></app.server>
<isExecutable>false</isExecutable>
</properties>
<dependencies>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp${app.server}</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<id>pgp</id>
<build>
<plugins>
<plugin>
<groupId>com.github.s4u.plugins</groupId>
<artifactId>pgpverify-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
<pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
<scope>test</scope>
<verifyPomFiles>true</verifyPomFiles>
<failNoSignature>false</failNoSignature>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Finally, I have solved it.
The CAS War overlay was loading two jars I couldn't exclude marking their dependencies as provided. The problem is that these jars came from the CAS overlay, it were copied into WEB-INF/lib of the generated war.
tomcat-embed-websocket-*.jar -> java.lang.ClassCastException
WEB-INF/lib/log4j-slf4j-*.jar -> Logging related exception
So I excluded them from the generated jar, using excludes.
https://maven.apache.org/plugins/maven-war-plugin/overlays.html
This is the final POM, which deploys correctly on Wildfly:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-overlay</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<build>
<plugins>
<!--
<plugin>
<groupId>com.rimerosolutions.maven.plugins</groupId>
<artifactId>wrapper-maven-plugin</artifactId>
<version>0.0.5</version>
<configuration>
<verifyDownload>true</verifyDownload>
<checksumAlgorithm>MD5</checksumAlgorithm>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
<addResources>true</addResources>
<executable>${isExecutable}</executable>
<layout>WAR</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>cas</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
<recompressZippedFiles>false</recompressZippedFiles>
<archive>
<compress>false</compress>
<manifestFile>${manifestFileToUse}</manifestFile>
</archive>
<overlays>
<overlay>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp${app.server}</artifactId>
<excludes>
<!-- Exclude these jars from the generated WAR:
-->
<exclude>WEB-INF/lib/log4j-slf4j-*.jar</exclude>
<exclude>WEB-INF/lib/tomcat-embed-websocket-*.jar</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
<finalName>cas</finalName>
</build>
<properties>
<cas.version>5.3.3</cas.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
<app.server></app.server>
<mainClassName>org.springframework.boot.loader.WarLauncher</mainClassName>
<isExecutable>false</isExecutable>
<manifestFileToUse>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF</manifestFileToUse>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Corporate repositories -->
<dependencies>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp${app.server}</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<!--
...Additional dependencies may be placed here...
-->
</dependencies>
</project>

Wildfly 10: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210

I am trying to use wildfly-swarm with a hello world web project (having a single index.html file) already running on glassfish. Here is my POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
<artifactId>MongoDBDemo</artifactId>
<groupId>com.test</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>bom</artifactId>
<version>${version.wildfly.swarm}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<groupId>com.test</groupId>
<artifactId>MongoDBDemo-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MongoDBDemo-web</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.wildfly.swarm>2016.8.1</version.wildfly.swarm>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<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>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am having this exception:
2016-09-01 16:37:10,543 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/MongoDBDemo-web/index.html
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:75)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)
I am running it using:
mvn wildfly-swarm:run
I don't know why I can't see any output on my browser, not even exception. Could you please tell me why its assuming index.html as a JAX-RS resource instead of a physical HTML file?
index.html is in src\main\webapp folder
By default WildFly Swarm doesn't add a context path to your application.
Have you tried accessing http://localhost:8080/index.html ??

Maven: Invalid content was found starting with element 'plugin'

I have updated my pom.xml with plagins and got error:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'. One of '{"http://maven.apache.org/POM/
4.0.0":parent, "http://maven.apache.org/POM/4.0.0":description, "http://maven.apache.org/POM/4.0.0":prerequisites,
"http://maven.apache.org/POM/4.0.0":issueManagement, "http://maven.apache.org/POM/4.0.0":ciManagement, "http://
maven.apache.org/POM/4.0.0":inceptionYear, "http://maven.apache.org/POM/4.0.0":mailingLists, "http://
maven.apache.org/POM/4.0.0":developers, "http://maven.apache.org/POM/4.0.0":contributors, "http://maven.apache.org/
POM/4.0.0":licenses, "http://maven.apache.org/POM/4.0.0":scm, "http://maven.apache.org/POM/4.0.0":organization,
"http://maven.apache.org/POM/4.0.0":build, "http://maven.apache.org/POM/4.0.0":profiles, "http://maven.apache.org/
POM/4.0.0":modules, "http://maven.apache.org/POM/4.0.0":repositories, "http://maven.apache.org/POM/
4.0.0":pluginRepositories, "http://maven.apache.org/POM/4.0.0":reports, "http://maven.apache.org/POM/4.0.0":reporting,
"http://maven.apache.org/POM/4.0.0":dependencyManagement, "http://maven.apache.org/POM/
4.0.0":distributionManagement}' is expected.
This is pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<groupId>com</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc16</artifactId>
<version>11.2.0.1.0</version>
<type>jar</type>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2ws-plugin</artifactId>
<version>2.5.1</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.company.app</groupId>
<artifactId>services</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<className>com.company.app.services.WebServiceBean</className>
<genWsdl>true</genWsdl>
</configuration>
<goals>
<goal>java2ws</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>process-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.build.directory}/generated/wsdl/WebServiceBean.wsdl</wsdl>
<extraargs>
<extraarg>-p</extraarg>
<extraarg>com.company.app.services.client.model</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</project>
How to solve this?
You have to add the following part in your pom file:
<build>
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
You need to add your code between <plugins> </plugins>
<build>
<plugins>
<plugin>
<!-- Add here -->
</plugin>
</plugins>
</build>
In case you have multiple plugins, you will add another <plugin> tag under <plugins>.

tomee mvn install don't pack META-INF

When trying to build war file maven doesn't pack any META-INF using pom:
<modelVersion>4.0.0</modelVersion>
<groupId>demo-test</groupId>
<artifactId>core-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<test.core.version>1.0.0</test.core.version>
</properties>
<modules>
<module>testDataModule</module>
<module>testFramework</module>
<module>testManagerModule</module>
<module>CoreWar</module>
</modules>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<!-- scope provided means the container delivers it -->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>test</finalName>
<plugins>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.5.2</version>
<configuration>
<finalName>test</finalName>
<tomeeVersion>1.5.2</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<path>C:\test\code\test.core\CoreWar\target\test.war</path>
<debug>true</debug>
<tomeeHost>localhost</tomeeHost>
<tomeeHttpPort>8080</tomeeHttpPort>
<libs>
<lib>mysql:mysql-connector-java:5.1.20</lib>
</libs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>..\testFramework\WebFramework\src\webapp\WEB-INF\web.xml</webXml>
<outputFileNameMapping>#{groupId}#-#{artifactId}##{dashClassifier?}#.#{extension}#</outputFileNameMapping>
</configuration>
</plugin>
</plugins>
</build>
and I tried puting META-INF everywhere.
and don't replace tomee.xml
I tried the following structure:
myApp->src->resources->meta-inf/persistence.xml
myApp->src->webapp->meta-inf/persistence.xml
did you try webapp/WEB-INF/persistence.xml?

Resources