Search code examples
mavenjboss6.xmaven-ear-pluginapplication.xml

application.xml for Jboss 6


Can we package ear for jboss 6 ? What will be application.xml uri ??

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee  /application_5.xsd">

<display-name>my-ear</display-name>
<module>
    <ejb>my-ejb</ejb>
</module>

I have tried changing version for version=6 but it is saying file not found.

Caused by: java.io.FileNotFoundException: http://www.jboss.org/j2ee/dtd/jboss-app_6_0.dtd

Does any one have face such problem with jboss 6 while deploying ear ????


Solution

  • I have solved it using maven ear plugin and removing manually created application.xml.

    Here is my ear pom it might be helpful for other

    <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.surajchhetry.test</groupId>
    <artifactId>test-ear</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>ear</packaging>
    
    <name>test-ear</name>
    
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
    <build>
        <finalName>test-ear</finalName>
        <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.4</version>
                <configuration>
                    <version>6</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <modules>
                        <ejbModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>test-ejb</artifactId>                           
                            <bundleFileName>test-ejb.jar</bundleFileName>
                        </ejbModule>
                        <jarModule>
                           <groupId>${project.groupId}</groupId>
                            <artifactId>test-api</artifactId>                            
                            <bundleFileName>test-api.jar</bundleFileName>                           
                        </jarModule>
                    </modules>
    
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>test-ejb</artifactId>
            <version>${project.version}</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>test-api</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
    
        </dependency>
    </dependencies>