Struts messagresources problem

T

TDOR

I add this line to my Form class in its validate method:

actionErrors.add("Name", new ActionMessage("errors.invalid"));

Pressing the submit button on the page that trigger the validation
I now get an exception (it got no exception before adding the above
line):

java.lang.NoClassDefFoundError: _page/_ProjectProperties (wrong name:
_page/_Projectproperties)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at com.evermind.util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
at oracle.jsp.runtimev2.JspClassLoader.loadClass(JspClassLoader.java:744)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at oracle.jsp.runtimev2.JspPageInfo.getInstFacade(JspPageInfo.java:167)
at oracle.jsp.runtimev2.JspPageTable.getInstFacade(JspPageTable.java:473)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:595)


Theese are my action mappings:

<action-mappings>
<action name="ProjectPropertiesForm"
path="/projectpropertiessubmit" input="/page/ProjectProperties.jsp"
type="timesheet.ProjectPropertiesAction" scope="request"
validate="true" unknown="false">
<forward name="success" path="/welcome.do"/>
<forward name="failure" path="/page/ProjectProperties.jsp"/>
</action>
<action path="/projectproperties"
forward="/page/Projectproperties.jsp" unknown="false"/>
<action path="/welcome" forward="/page/Welcome.jsp"
unknown="true"/>
</action-mappings>

Im using the struts-blank sample from struts 1.2.7. The
MessageResources.properties file is located under web-inf/classes.
The page with the submit button contains a <html:errors/> tag.
Any1 know what im doing wrong?
 
W

Wendy Smoak

TDOR said:
I add this line to my Form class in its validate method:
actionErrors.add("Name", new ActionMessage("errors.invalid"));

Pressing the submit button on the page that trigger the validation
I now get an exception (it got no exception before adding the above
line):

java.lang.NoClassDefFoundError: _page/_ProjectProperties (wrong name:
_page/_Projectproperties)

No idea why adding an error is provoking it, but the problem is that you
have ProjectProperties in some places and Projectproperties in others (note
the capitalization). I bet you're on Windows, which is normally not case
sensitive, but the Servlet container *is*.
<action name="ProjectPropertiesForm"
path="/projectpropertiessubmit" input="/page/ProjectProperties.jsp" ....
<forward name="failure" path="/page/ProjectProperties.jsp"/> ....
forward="/page/Projectproperties.jsp" unknown="false"/>

I assume you don't really have BOTH a Projectproperties.jsp and a
ProjectProperties.jsp. Pick one, fix all the instances of that name, and
then (this is important) stop the container and clean out the work directory
to get rid of all of the generated and compiled JSP code for this webapp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top