2012-04-19 79 views
0


我們有一個「舊」JavaEE應用程序,我們希望從舊的Sun Application Server 9.1移植到當前的Glassfish 3.1。我們更新了部署描述符xml文件(重命名了它們,更新了DocType,針對DTD進行了驗證,沒有其他)。但是,當我們試圖將部署到GF3.1我們得到這個錯誤:Glassfish 3.1b41 - JDO83008:CMP編譯失敗:找不到類文件

JDO83008: CMP Compilation failed: 
C:\workspace\glassfish31eclipsedefaultdomain\generated\ejb\archivetool-app-1.9.5\archivetool-ejb-1.9.5_jar\de\ems\archivetool\ejb\metadata\cd\eb\CdBean_821611534_ConcreteImpl.java:10: 
cannot access de.ems.archivetool.ejb.framework.AbstractCMPBean 
class file for de.ems.archivetool.ejb.framework.AbstractCMPBean not found 

C:\workspace\glassfish31eclipsedefaultdomain\generated\ejb\archivetool-app-1.9.5\archivetool-ejb-1.9.5_jar\de\ems\archivetool\ejb\productdata\product\eb\ProductionLibraryBean40992531_ConcreteImpl.java:416: 
cannot find symbol 

symbol : class EBSBusinessException 
location: package de.ems.archivetool.ejb.framework 

WARNUNG: JDO83004: CMP Compilation failed. See log for details. 
SCHWERWIEGEND: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method 
SCHWERWIEGEND: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method 
SCHWERWIEGEND: Exception while preparing the app 
SCHWERWIEGEND: JDO83004: CMP Compilation failed. See log for details. 
org.glassfish.deployment.common.DeploymentException: JDO83004: CMP Compilation failed. See log for details. 

但是,我們仍然可以在老SUN應用服務器在部署。

該應用程序由4個模塊和一個構建模塊組成。一般來說,包含兩個EJB模塊,一個WAR模塊和一個JAR模塊的.ear文件是用Maven構建的,沒有任何問題(UnitTest成功等)。因此,一切都很好,但是當我們嘗試將應用程序部署到GF3.1時,我們得到了「找不到類文件」的錯誤。未找到的類位於JAR模塊內幷包含EJB模塊的基類。

有沒有人有起點?

問候, 安德烈亞斯

回答

0

好吧,googeling了幾個小時之後,我終於找到了確切的答案對這個問題here。 重要的部分是:

The Java EE 6 specification imposes strict rules about which JAR files are visible from an enterprise archive (EAR) file. Refer to section EE.8.3.3; specifically, application client modules should not have access to any EJB JAR file unless the application client JAR file's manifest Class-Path refers to the EJB JAR file(s) explicitly.

This is a change from GlassFish Server v2, in which application clients automatically had access to all EJB JAR files in the EAR file and all JAR files at the top level of the EAR file. To comply with the stricter specification language, GlassFish Server 3.0.1 cannot automatically provide application clients with access to these JAR files.

你所要做的是,讓行家把罐子(和其他依賴)到庫文件夾在耳朵容器。您可以通過添加以下內容到你的耳朵的pom.xml做到這一點:

<build> 
    <plugins> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-ear-plugin</artifactId> 
     <configuration> 

     //here starts the important part 
     <defaultLibBundleDir>lib</defaultLibBundleDir> 
     <archive> 
     <manifest> 
      <addClasspath>true</addClasspath> 
     </manifest> 
     </archive> 
     //end of important part 

    <modules> 
    <jarModule> 
     <groupId>gID</groupId> 
     <artifactId>aID</artifactId> 
    </jarModule> 

    //etc some more ebjs, war, ... 
    </modules> 

這將使罐子模塊到一個文件夾lib下,和所有依賴的EJB會得到他們的MANIFEST.MF的Class-Path條目。

希望能幫助你們中的一些人解決同樣的問題。