Hit AppDeploymentException when deploy on WebSpher

2019-08-03 04:06发布

问题:

I made the war file through eclipse IDE, and when deploy it to WebSphere 6.1, I hit the following error:

The EAR file could be corrupt and/or incomplete. Make sure that the application is at a compatible Java 2 Platform, Enterprise Edition (J2EE) Level for WebSphere Application Server. AppDeploymentException: [null] java.lang.ClassCastException: org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl incompatible with org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile

I had been searching around so far couldn't fine a workable solution? Any clue would be much appreciated.

回答1:

In WebSphere 6.1, it doesn't support xml schema version 2.5, it only up until 2.4. And take note that the jdk is version 1.5 from IBM version, not SUN. Below is the correct declaration in the web.xml.

<web-app id="WebApp_ID" version="2.4"  xmlns="http://java.sun.com/xml/ns/j2ee"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


回答2:

I saw a very similar error deploying to WebSphere 6.1. In my case the problem was that I created the EAR file manually and I had the content of the EAR in a sub-folder by mistake. Unzip your EAR and check that all config files are at the right level, ie. ./META-INF/application.xml