0

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>
Ganesan S
  • 85
  • 1
  • 3
  • 13

1 Answers1

0

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.

Frito
  • 446
  • 2
  • 12
  • Whether I can keep deployable files as well as dependency jar in the root directory. Is it possible? For me ClassNotFoundException is coming in my deployable jar not in dependency jars – Ganesan S Oct 19 '18 at 14:14
  • You should be able by using the library-directory element as mentioned above. But the question is... why? This will slow down deployment, since all the JARs must be scanned for annotations. I would recommend to use the default EAR structure until you have a very good reason to do it differently. – Frito Oct 20 '18 at 14:07