【问题标题】:Why incompatible version of Java EE error throw from WebSphere?为什么从 WebSphere 抛出不兼容版本的 Java EE 错误?
【发布时间】:2011-09-08 02:26:35
【问题描述】:

我在部署我的应用程序时使用了 WebSphere Allication Server 版本 7.0.0.13。战争是使用 Ant 1.8.2 版本来构建战争和耳朵文件的。当我通过 WebSphere 安装我的应用程序时,我遇到了以下错误:

EAR 文件可能已损坏和/或不完整。确保 应用程序位于兼容的 Java(TM) 平台企业版 当前版本的 WebSphere(R) Application 的 (Java EE) 级别 服务器。

com.ibm.websphere.management.application.client.AppDeploymentException [根异常是 org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: dd_in_ear_load_EXC_]

我可以知道导致问题的原因吗?还是我错过了在 Ant 脚本中配置的东西?下面是编译 WAR 和 EAR 的 ANT 脚本。

<target name="compilewar" description="generating war">
        <war destfile="${dist.path}/WebApp.war" webxml="${source.path}/mywebapp/src/main/webapp/WEB-INF/web.xml">
            <webinf dir="${source.path}/mywebapp/src/main/webapp/WEB-INF/" includes="**/*"/>
            <lib dir="${dist.path}/" includes="*.jar"/>
            <classes dir="${source.path}/mywebapp/src/main/resources/" includes="**/*"/>
            <fileset dir="${source.path}/mywebapp/src/main/webapp/">
                <include name="**/*.jsp"/>
            </fileset>
            <fileset dir="${source.path}/mywebapp/src/main/webapp/">
                <include name="main/**/*"/> 
            </fileset>
        </war>
    </target>

<target name="compileear" description="Compile Ear file">
        <ear destfile="${source.path}/myear/src/main/application/WebApp.ear" appxml="${svn.working.project.path}application.xml">
            <metainf dir="${source.path}/mywebapp/src/main/webapp/META-INF"/>
            <fileset dir="${dist.path}/" includes="*.war"/>
        </ear>
    </target>

谢谢@!

【问题讨论】:

    标签: jakarta-ee ant websphere


    【解决方案1】:

    @huahsin68:确保您使用 WAS JDK 来编译您作为 war 文件的一部分打包的类。如果你也使用ant编译,请确保ANT使用WAS JDK作为java环境运行。

    Server 的 systemout.log 和 startServer.log 肯定给出了更多的日志。检查一下。

    如果您使用 Eclipse 之类的 IDE,请将项目合规级别设置为 J2EE1.5 并清理并重新构建。

    【讨论】:

    • 非常感谢您的咨询。我会调查的。顺便说一句,我正在使用纯 ANT 脚本进行编译。
    【解决方案2】:

    我的问题已经解决了。这是由于 javac ant 任务中缺少 source 属性。正如 source 属性的 ANT 文档中所述:

    请注意,默认值取决于运行 Ant 的 JVM。我们 强烈建议始终指定此属性。

    建议指定要用于编译的 java 版本。以下是源属性的示例用法:

    <javac source="1.6"/>
    

    谢谢@!

    【讨论】:

      【解决方案3】:

      似乎您正在尝试在支持 Java EE 5 的 WAS 7 中部署与 j2ee 1.3/1.4 兼容的 WAR/EAR。检查您的 application.xml 和 web.xml 以查看您是否使用了正确的架构版本。还要检查 IBM 特定的部署描述符。我在 WAS 支持网站上found this link

      【讨论】:

      • 你提到了架构版本的事情,这可能是我继续搜索的线索。我可以知道如何检查我当前在 web.xml 和 application.xml 中的 j2ee 版本吗?
      • @huahsin68 检查 servlet 规范
      • 不,如果您在 WAS 7 上部署 J2EE 1.3/1.4,则不会出现该错误;它支持这些级别。见publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/…
      • @dbreaux 非常感谢您的参考。
      【解决方案4】:

      我在 whesphere 中安装简单 EAR 时遇到了同样的异常:[根异常是 org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: dd_in_ear_load_EXC_] 原因是 EAR 中的 WAR被打开包装。所以,我构建了一个新的 EAR,里面有一个打包的 WAR,它起作用了。在我的情况下,我使用的是 MAVEN,插件是(观察标签 unpackfalse 值)

              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-ear-plugin</artifactId>
                  <version>2.10</version>
                  <configuration>
                     <modules>
                        <webModule>
                           <groupId>com.javaen</groupId>
                           <artifactId>myApp</artifactId>
                           <uri>myWar.war</uri>
                           <bundleFileName>myWar.war</bundleFileName>
                           <contextRoot>/myWar</contextRoot>
                           <unpack>false</unpack>
                        </webModule>
                     </modules>
                  </configuration>
               </plugin>
      

      希望对你有帮助,问候

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-30
        • 2011-07-19
        • 1970-01-01
        • 1970-01-01
        • 2017-04-22
        • 2020-06-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多