Monday, July 17, 2006

Can't deploy WAR on WebSphere 6 - AppDeploymentException

Keywords:
websphere war deploy install "The EAR file might be corrupt or incomplete" DeploymentDescriptorLoadException

Problem:
Trying to deploy ("install") a war file (for the Jakarta Slide WebDAV Server) in WebSphere after it appeared to work fine on Tomcat & JBoss gets the following two messages in the WebSphere Administration Console:

  1. The EAR file might be corrupt or incomplete.

  2. AppDeploymentException: [null] com.ibm.etools.j2ee.commonarchivecore.exception.DeploymentDescriptorLoadException: IWAE0022E Exception occurred loading deployment descriptor for module "[warfilename].war" in EAR file "[WebSphereHome]\profiles\[ProfileName]\wstemp\[TempFolder]\upload\[warfilename]_war.ear"


Solution:
The first message (and the .ear part of the second) is very confusing and from a quick google it seems that many developers are thrown off and attempt to put their war file in an ear ... it's not necessary.

The clue was the cause exception "DeploymentDescriptorLoadException" in the second message. It's a long story how I got to this, but the issue was my deployment descriptor - WEB-INF\web.xml. WebSphere validates this against the schema for the web.xml and is not flexible. Add this detail to you opening <web-app> node in your web.xml and make sure it is valid according to the schema (using an editor such as XML Spy):
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee"   
xsi="http://www.w3.org/2001/XMLSchema-instance" 
schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


In my situation slide contained a security-constraint which in turn referenced http-method names that aren't valid according to the web.xml spec (limited to HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE). But WebDAV extends the HTTP spec ... not sure what to do about that. Commenting out the entire security-constraint section or the offending http-method references fixes the issue for the mean time.


Notes:
Next issue is how to configure some basic users and roles in WebSphere. The documentation seems very thorough on overviews and definitions, but light-on when it comes to how-tos.

4 comments:

Alex said...

Another reason for this exception could be that the taglib tag is not wrapped around the <jsp-config> tag.
So a valid web.xml 2.4 with taglib declaration would be:

<jsp-config>
<taglib>...</taglib>
<taglib>...</taglib>
</jsp-config>

Alex said...

For version 2.3 of web-app it appears to be sufficient to simply add <web-app id="WebAppId">

venkat said...

Excellent, it worked. I validated the XML in Internet Explorer at http://www.w3schools.com/XML/xml_validator.asp (Note: It only works in IE)

Thanks
Venkata Madugundu

Anonymous said...

Thank you SososoSo much!!!