Reputation: 129
I am new in EAR applications development. I am trying to build application with the following structure:
(I am using Red Hat JBoss Developer Studio as IDE and wildfly as server)
After creation of above structure i tested it - everything worked fined.
I wanted to add maven support to whole solution so according to found articles I used wizard: right click on project "Configure" -> "Convert to maven project". I did it for ejb and web module firstly and then for ear. I also modified ear pom.xml file and application.xml file.
After this conversion my web module stop working. Attempt to view welcome page returns error 404.
Below you can find EAR 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>sri3</groupId>
<artifactId>sri3</artifactId>
<version>1.0.0</version>
<packaging>ear</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<earSourceDirectory>EarContent</earSourceDirectory>
<version>7</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<webModule>
<groupId>sri3.web</groupId>
<artifactId>sri3.web</artifactId>
</webModule>
<ejbModule>
<groupId>sri3.ejb</groupId>
<artifactId>sri3.ejb</artifactId>
</ejbModule>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>sri3.web</groupId>
<artifactId>sri3.web</artifactId>
<version>1.0.0</version>
<type>war</type>
</dependency>
<dependency>
<groupId>sri3.ejb</groupId>
<artifactId>sri3.ejb</artifactId>
<version>1.0.0</version>
<type>ejb</type>
</dependency>
</dependencies>
</project>
Below you can find EAR application.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" id="Application_ID" version="7">
<display-name>sri3</display-name>
<module>
<web>
<web-uri>sri3.web.war</web-uri>
<context-root>sri3.web</context-root>
</web>
</module>
<module>
<ejb>sri3.ejb.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
I found several articles and questions with wide description of proper EAR configuration but none of them helped me. What I ommmited?
Thanks all in advance.
Upvotes: 1
Views: 1160
Reputation: 306
You Should build a project for maven as follow :
Main Project
--------Child Project(EJB)
--------Child Project (WEB)
--------CHild Project (EAR)
If you have a netbeans , netbeans build a simple project if you select maven enterprise template Good luck
Upvotes: 2