You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Paap, Keith" <Ke...@westgroup.com> on 2001/09/28 15:29:47 UTC

RE: Digester throwing ClassNotFoundException for ActionFormBean

Below is part of an old thread I found in the mailing list archives
regarding the ClassNotFoundException on ActionFormBean.  I am also using
JRun and have suddenly come across this problem as well.  I'm curious if
anyone can suggest any ideas of how I can resolve the problem.  

Below I've included a number of options that I've tried so far and the
results that I ran into.  

The maddening thing is that nothing has been changed in the environment
other than the application classes, resource properties (i18n),  and the
struts-config.xml file.  I've been through the struts-config.xml file
multiple times and don't see anything wrong.  I've also rolled back to
earlier versions that had worked before and they now have the same error.

Any help/suggestions MOST appreciated.  This is proving to be a development
killer.

Environment:  

JRun 3.1, JAXP 1.1 (crimson.jar, jaxp.jar, xalan.jar added and parser.jar
removed), Win2KP, Struts build from 9/21/01, (struts.jar, log4j.jar, and 3
commons jars all in the WEB-INF\lib) directory for my application.

*Here is the actual error that suddenly started to occur:

09/28 07:21:01 info (JRun) action: init
09/28 07:21:01 info (JRun) action: Loading application resources from
resource com.devapp.lang.ApplicationResources
09/28 07:21:01 info (JRun) action: Initializing configuration from resource
path /WEB-INF/struts-config.xml
09/28 07:21:02 error (JRun) Could not pre-load servlet: action
[javax.servlet.ServletException: Parsing error processing resource path
/WEB-INF/struts-config.xml]
[1]java.lang.ClassNotFoundException: org.apache.struts.action.ActionFormBean
	at
org.apache.commons.digester.Digester.startElement(Digester.java:627)
	at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1449)
	at org.apache.crimson.parser.Parser2.content(Parser2.java:1700)
	at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1468)
	at org.apache.crimson.parser.Parser2.content(Parser2.java:1700)
	at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1468)
	at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:499)
	at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
	at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:346)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:158)
	at org.apache.commons.digester.Digester.parse(Digester.java:859)
	at
org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:1273)
	at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:460)
	at javax.servlet.GenericServlet.init(GenericServlet.java:258)
	at
allaire.jrun.servlet.JRunServletLoader.loadServletInstance(../servlet/JRunSe
rvletLoader.java:203)
etc.

*Here's some of the things I've tried and their results

-Moved the struts.jar to the server class path. (Even though it states NOT
to do this.)
This got past the problem setting up the forms and actions from the
struts-config.xml file but then I get exceptions when it attempts to locate
the message keys in the MessageTag.

Exception thrown processing JSP page.
javax.servlet.jsp.JspException: Missing message for key index.title
	at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298)
      etc.

-With jar files in the /WEB-INF/lib directory I added that directory to the
server classpath.
This resulted in the same problem as the previous test where I just moved
the jars to a directory already in the server classpath.

-I've checked for any other instances of struts.jar that could be in the
classpath and there are not any (the same holds true for the commons*.jar
files).


*Here's the original thread I found in the mailing archive from last August:

Title: Digester throwing ClassNotFoundException for ActionFormBean
I'm using JRun 3.0 SP2 on WinNT 4 with the 8/14 nightly build of Struts. 
With all of the commons-*.jar and struts.jar in WEB-INF/lib, I get a stack
trace showing ClassNotFoundException for ActionFormBean when JRun attempts
to load-on-startup the ActionServlet.
If I remove the load-on-startup from my web.xml I stop getting the
ClassNotFoundException but get that org.apache.struts.action.MESSAGE
couldn't be found error.
As a workaround I've included all the struts jars and my WEB-INF/classes
directory in the server classpath and it seems to work fine but I'm pretty
sure that I can't hot deploy anymore.
>From the stack trace I see ActionServlet call Digester which calls down
through JAXP and Xerces until it gets to Digester.startElement and throws
the ClassNotFoundException. I'm wondering if Xerces is loading funny or
somehow it's Xerces classloader thats being used to search for
ActionFormBean instead of my web app's classloader... I have to put xerces
and xalan first in my server classpath so it gets used when I use JAXP. But
it seems like my application should work as long as the Struts classes are
loaded in my web apps classloader because (as I understand it) child
classloaders will ask their parent if they have a class but a parent wont
ask a child.
I included my stack trace below: 
08/15 11:05:07 error (JRun) Could not pre-load servlet: action
[javax.servlet.ServletException: Parsing error processing resource path
/WEB-INF/struts-config.xml]
[1]java.lang.ClassNotFoundException: org.apache.struts.action.ActionFormBean

at org.apache.commons.digester.Digester.startElement(Digester.java:627) 
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376) 
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidat
or.java:1197) 
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne
r.java:1862) 
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1238) 
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381) 
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035) 
at javax.xml.parsers.SAXParser.parse(SAXParser.java:374) 
at javax.xml.parsers.SAXParser.parse(SAXParser.java:192) 
at org.apache.commons.digester.Digester.parse(Digester.java:859) 
at
org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:1272) 
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:459) 
at javax.servlet.GenericServlet.init(GenericServlet.java:258) 
at
allaire.jrun.servlet.JRunServletLoader.loadServletInstance(../servlet/JRunSe
rvletLoader.java:203) 
at
allaire.jrun.servlet.JRunServletLoader.loadServletInstance(../servlet/JRunSe
rvletLoader.java:161) 
at
allaire.jrun.servlet.JRunServletLoader.loadServlet(../servlet/JRunServletLoa
der.java:149) 
at
allaire.jrun.servlet.JRunSE.getServletReference(../servlet/JRunSE.java:1706)

at allaire.jrun.servlet.JRunSE.preloadServlets(../servlet/JRunSE.java:1372) 
at allaire.jrun.servlet.JRunSE.init(../servlet/JRunSE.java:237) 
at allaire.jrun.ServletService.init(../ServletService.java:66) 
at allaire.jrun.ServletService.init(../ServletService.java:31) 
at
allaire.jrun.servlet.JRunServletLoader.loadServletInstance(../servlet/JRunSe
rvletLoader.java:203) 
at allaire.jrun.servlet.JRunSE.initService(../servlet/JRunSE.java:892) 
at allaire.jrun.servlet.JRunSE.initServices(../servlet/JRunSE.java:859) 
at
allaire.jrun.servlet.JvmContext.initServices(../servlet/JvmContext.java:130)

at allaire.jrun.servlet.JRunSE.init(../servlet/JRunSE.java:223) 
at allaire.jrun.servlet.JvmContext.init(../servlet/JvmContext.java:69) 
at allaire.jrun.ServletService.init(../ServletService.java:66) 
at allaire.jrun.ServletService.init(../ServletService.java:31) 
at JRun.main(../../../JRun.java:172) 
Thanks for any help you can offer. 
Todd Hough