Glassfish 3.1b41 - JDO83008:CMP编译失败:找不到类文件

时间:2012-04-19 12:47:20

标签: java deployment glassfish glassfish-3


我们有一个“旧的”JavaEE应用程序,我们希望从旧的Sun Application Server 9.1移植到当前的Glassfish 3.1。我们更新了部署描述符xml文件(重命名它们,更新了DocType,根据DTD验证,没有别的)。但是当我们尝试部署到GF3.1时,我们得到了这个错误:

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 App Server中部署。

该应用程序由4个模块和一个构建模块组成。通常,.ear文件由两个EJB模块,一个WAR模块和一个JAR模块组成,使用Maven构建时没有问题(UnitTest成功等)。 (pom.xml和结果application.xml

所以,一切都很好,但是当我们尝试将应用程序部署到GF3.1时,我们得到“找不到类文件”错误。未找到的类位于JAR模块中,并包含EJB模块的基类。

有没有人有起点?

此致 安德烈亚斯

1 个答案:

答案 0 :(得分:0)

好的,经过几个小时的googeling,我终于找到了这个问题的确切答案here。 重要的是:

  

Java EE 6规范对哪些JAR文件规定了严格的规则   从企业归档(EAR)文件中可见。请参阅部分   EE.8.3.3;特别是,应用程序客户端模块不应该有   访问任何EJB JAR文件,除非应用程序客户端JAR文件   manifest-Path显式引用EJB JAR文件。

     

这是对GlassFish Server v2的更改,在该应用程序中   客户端自动访问EAR文件中的所有EJB JAR文件   以及EAR文件顶层的所有JAR文件。遵守   更严格的规范语言,GlassFish Server 3.0.1不能   自动为应用程序客户端提供对这些JAR的访问权限   文件。

你要做的是,让maven将jar(和其他依赖项)放入ear容器中的library文件夹中。你可以把它添加到你的耳朵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>

这会将jar模块放入文件夹lib中,所有依赖的ejbs将在其MANIFEST.MF中获取Class-Path条目。

希望能帮助你们中的一些人解决同样的问题。

相关问题