Main Menu
Home
About Me
Blog
Articles
FAQs
Contact Me
Search
Syndicate
feed image
 
   
Home arrow Blog arrow Don't forget that / in front of WEB-INF
Don't forget that / in front of WEB-INF PDF Print E-mail
Written by Chintan Rajyaguru   
Wednesday, 13 September 2006

It's easy to guess that these days I have moving some projects between IDEs (WSAD to RAD to WAS 6.1 toolkit). The issue I have spent most time fixing is this exception…

 

uncaught init() exception thrown by servlet action: javax.servlet.UnavailableException: Parsing error processing resource path WEB-INF/struts-config.xml

at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:769)

at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:741)

at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:687)

at org.apache.struts.action.ActionServlet.init(ActionServlet.java:333)

at javax.servlet.GenericServlet.init(GenericServlet.java:256)

<more …>

 

Obviously when you see a parsing error, you would think your struts-config.xml file is either not well formed or not valid. I checked and double checked with various xml tools only to find out that my struts-config was fine. Upon close inspection of my web.xml file, I realized that the file defined struts-config.xml like this

<init-param>

<param-name>config</param-name>

<param-value>WEB-INF/struts-config.xml</param-value>

</init-param>

 

This is incorrect. The location of struts-config.xml should be defined relative to the web application root like this:

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

 

Notice the slash in front of WEB-INF. This tells the parser to look for struts-config.xml relative to the web application root. If you don't put the slash, the parser looks for the file relative to the current location (i.e. relative to the web.xml file in which the entry is defined).

 

Surprisingly, the entry without slash worked fine in WSAD (I don't know why) but when moved to RAD, it gave me the exception. What makes it worse is the exception reporting. Looking at the stack trace there is no way to know what the actual problem is. To an extent all these xml based frameworks suffer from this problem but more on that later.

LIST OF COMMENTS ....


1. Written by Guest/Visitor
    Wednesday, 06 December 2006
this is most useful information, thank you

2. Written by Guest/Visitor
    Tuesday, 23 January 2007
There is a solution for the Websphere Application Server 6.x at http://www-1.ibm.com/support/docview.wss?uid=swg21190234

3. Written by Guest/Visitor
    Wednesday, 09 January 2008
THANKS. THANKS. THANKS

4. Written by Guest/Visitor
    Thursday, 27 November 2008
if in a project,struts is not being used, and we got the same problem, then what might be the case?? any idea??

Write your comment here (support html tag):

Random Code
Random Code Verification
 
 
< Prev   Next >
BlogSidebar
 
 

Copyright Chintan Rajyaguru
Contact me if you have any questions or comments.