为什么Java EE错误的不兼容版本会从WebSphere中抛出?

时间:2011-09-08 02:26:35

标签: java-ee ant websphere

我在部署应用程序时使用的是WebSphere Allication Server V7.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>

谢谢@!

4 个答案:

答案 0 :(得分:4)

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

服务器的systemout.log和startServer.log必须提供更多日志。检查一下。

如果您使用的是像eclipse这样的IDE,请将项目合规性级别设置为J2EE1.5并清理并重新构建。

答案 1 :(得分:1)

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

答案 2 :(得分:1)

我解决了问题。这是由于javac ant任务中缺少属性。正如ANT文档中提到的属性:

  

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

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

<javac source="1.6"/>

谢谢@!

答案 3 :(得分:0)

当我在whesphere中安装一个简单的EAR时,我遇到了同样的异常:[root异常是org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException:dd_in_ear_load_EXC_],原因是EAR中的WAR打开包装。因此,我在内部构建了一个带有压缩WAR的新EAR,并且工作正常。在我的情况下,我使用的是MAVEN,插件是(观察标签解包 false 值)

        <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>

我希望这能帮到你,问候