My blog stats clearly indicate that many visitors find my posts through search engines. What is mostly queried are solutions or hints for software problems. That’s why I’ll keep posting solutions to interesting problems.
While deploying a Struts based application on a co-worker’s Eclipse/Tomcat installation we were faced with a nice ActionServlet exception (org.apache.struts.action.ActionServlet abbreviated as ActionServlet):
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/config/salesstories/struts-config.xml at ActionServlet.handleConfigException(ActionServlet.java:1035) at ActionServlet.parseModuleConfigFile(ActionServlet.java:1014) at ActionServlet.initModuleConfig(ActionServlet.java:955) at ActionServlet.init(ActionServlet.java:470)
We knew that the path to struts-config.xml was correct, but we couldn’t get to the root of the problem. So, we started debugging ActionServlet#parseModuleConfigFile(). We found that the “real” exception was a SaxParseException due to “premature end of file”. That left us even more puzzled as struts-config.xml was a perfectly valid XML file.
So, we started to play around with that file. Erase the encoding declaration, remove certain segments, etc. Nothing helped. Then I discovered that the SaxParseException with the misleading message “premature end of file” carried a InvocationTargetException as its cause. Now that started to look interesting. That exception’s message brought me to the real problem: “Unsupported major.minor version“!
My co-worker had set up Eclipse to use a Java 5 JDK to compile his code, but had run Tomcat using a Java 1.4 version. Ok, this doesn’t necessarily cause problems unless you set the compiler’s compliance level to 1.5, which my co-worker had done.
wow I spent almost two days debugging this issue but couldn’t figure out the problem…
I followed ur article and it just did the magic.
Thanks for this great help