views:

24

answers:

1

Hello,

I have some problems with my .ear file. The structure of the file is:

app.ear
|-xxx.jar
 -yyy.jar
 -zzz.jar
 -ektorp.jar
 -app-ejb.jar
 -app-web.war
  |-WEB-INF
    |-lib
      |-xxx.jar
      |-yyy.jar
      |-zzz.jar
      |-ektorp.jar

When I try to deploy my application, I get ClassNotFoundException, with class wihch is in ektorp.jar. This file is used by ejb module.

I also don't know why these jars are doubled? In ear and in war module are the same .jar files.

Ear is built by maven2.

+1  A: 

When I try to deploy my application, I get ClassNotFoundException, with class which is in ektorp.jar. This file is used by ejb module.

Does the EJB-JAR reference ektorp.jar in the Class-Path: entry in the manifest (see Packaging EJB 3 Applications for more background on this)? The FAQ explains how you can configure the plugin to generate a Class-Path: entry in the manifest:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <version>2.2.1</version>
        ...
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
           </manifest>
         </archive>
       </configuration>
        ...
     </plugin>
   </plugins>
 </build>
  ...
</project>

Just in case, do you know that you can package EJBs in a .war with Java EE 6 (the difference is that all classes are loaded with the same classloader when using the .war packaging)? If you don't have strong modularization requirements, the .war packaging is simpler.

Pascal Thivent