Ear Deployment in Jboss AS 7 failure with ClassNotFoundException

125 views Asked by At

I am migrating an existing project to AS7. My Ear Structure is below, Guys some one please help the structure is correct or not. Because I am getting ClassNotFoundException when I am deploying, I think I have placed jar in wrong place.

Ear
  webmodule.war
  Ejbmodule.jar

When I extract ear.

META_INF
       |-> maven
                |-> com.myapp.mss
                |-> ear
                    pom.properties
                    pom.xml
       application.xml
       Manifest.mf
one.jar
two.jar
three.jar
My-ejb-module.jar
My-web-module.war

Whether lib folder is necessary for JBoss EAP 7 ?

I am using maven for build.

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <ejbVersion>3.0</ejbVersion>
                <generateClient>false</generateClient>
                <jarName>myappejb-${env}-${pom.version}</jarName>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
                <finalName>myapp-${env}-${pom.version}</finalName>
                <modules>
                    <webModule>
                        <groupId>com.myapp.mss</groupId>
                        <artifactId>webModule</artifactId>
                        <contextRoot>/myapp</contextRoot>
                        <bundleFileName>mssweb-${env}-${pom.version}.war</bundleFileName>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
1

There are 1 answers

2
Frito On

Deployable files are placed in the root directory of your EAR. Dependency JARs should be placed in the lib directory in your EAR. You can override the lib directory with a custom value by using the library-directory tag within your EARs deployment descriptor.

Documentation of the library-directory tag from the XSD:

The library-directory element specifies the pathname of a directory within the application package, relative to the top level of the application package. All files named "*.jar" in this directory must be made available in the class path of all components included in this application package. If this element isn't specified, the directory named "lib" is searched. An empty element may be used to disable searching.