aspose file tools*
The moose likes Struts and the fly likes Error in Struts Application(Cannot find message resources under key org.apache.strut) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error in Struts Application(Cannot find message resources under key org.apache.strut)" Watch "Error in Struts Application(Cannot find message resources under key org.apache.strut)" New topic
Author

Error in Struts Application(Cannot find message resources under key org.apache.strut)

Shaikh Riyaz
Greenhorn

Joined: Mar 08, 2005
Posts: 20
Hi ,
I am fighting with this error from last 2 days ,
I try all the things.
i am pasting the stackTrace .
javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.PgInput_jsp._jspService(PgInput_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


root cause

javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.java:1103)
org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043)
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294)
org.apache.jsp.PgInput_jsp._jspx_meth_bean_message_0(PgInput_jsp.java:138)
org.apache.jsp.PgInput_jsp._jspx_meth_html_html_0(PgInput_jsp.java:108)
org.apache.jsp.PgInput_jsp._jspService(PgInput_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


my web.xml file is --->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Struts ExampleWeb</display-name>

<servlet>
<servlet-name>CewolfServlet</servlet-name>
<servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
<!-- sets storage implementation -->
<init-param>
<param-name>storage</param-name>
<param-value>de.laures.cewolf.storage.TransientSessionStorage</param-value>
</init-param>
<!-- sets overlib.js location relative to webapp -->
<init-param>
<param-name>overliburl</param-name>
<param-value>etc/overlib.js</param-value>
</init-param>
<!-- turn on or off debugging logging -->
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>



<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>org.struts.example.strutsexample</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>CewolfServlet</servlet-name>
<url-pattern>/cewolf/*</url-pattern>
</servlet-mapping>



<session-config>
<session-timeout>600</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>




<taglib>
<taglib-uri>WEB-INF/tlds/struts-form.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-form.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>WEB-INF/tlds/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>WEB-INF/tlds/struts.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>WEB-INF/tlds/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>WEB-INF/tlds/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>WEB-INF/tlds/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>

</web-app>


my struts-config.xml is------------>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">


<struts-config>

<!-------Form Bean Definition-------------->



<form-beans>

<form-bean name=""StrutsInputFormBean type="org.struts.example.StrutsInputForm" />

<form-bean name=StrutsDisplayFormBean type="org.struts.example.StrutsDisplayForm" />

</form-beans>
<!------------
<global-exceptions>
<exception
key="global.error.invalidlogin"
path="/login.jsp"
scope="request"
type="com.quest.bts.service.InvalidLoginException"/>
</global-exceptions>
---------------------->
<!--------=============Global Forward Definition===============--------------->
<global-forwards>
<forward name="Menu" path="/index.html" />

</global-forwards>

<!----------=================Action Mapping Definition=======================---------->

<action-mappings>
<action path="/StrutsInputPath"
type="org.struts.example.StrutsInputAction"
name="StrutsInputFormBean"
scope="request"
input="/PgInput.jsp"
validate="true">

<forward name="next" path="/PgDisplay.jsp" />
</action>

<action path="/StrutsDisplayPath"
type="org.struts.example.StrutsDisplayAction"
name="StrutsDisplayFormBean"
scope="request"
input="/PgDisplay.jsp">

</action>

</action-mappings>

<message-resources parameter="strutsexample"/>
<message-resources parameter="ISOCodeRes" key="ISOCodeRes"/>

<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
</plug-in>

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>


</struts-config>

i put each and every thing at the right place , but i dont know you it is showing error,plzz help me to solve this problem
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I am new to struts, so bare with me. I think the problem may be the following:


You have 2 message resource bundles declared, one assigned to the key "ISOCodesRes" and the other to the default key "org.apache.struts.action.MESSAGE".

I believe struts cannot find the following resource bundle:
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Please check strutsexample.properties is saved in WEB-INF/classes


Sarath Mohan
Shaikh Riyaz
Greenhorn

Joined: Mar 08, 2005
Posts: 20
Hi all Thanx for your reply,
But tryed all the thing.
I put only one <message-resources parameter="strutsexample.properties"/>
even then it is showing the same error.
i am pasting my .properties file plz check it ,and it is located in WEB-INF/classes folder .just tell me how to put resource file in a classpath.


this is strutsexample.properties


strutsexample.title1=Struts Example Project - Input Form
strutsexample.title2=Struts Example Project - Display Page
strutsexample.name=Enter your Name
strutsexample.address=Enter your Address
strutsexample.city=Enter your City
strutsexample.state=Enter your State
strutsexample.zipcode=Enter your ZipCode

error.name.required=<li>You must enter your Name</li>
error.address.required=<li>You must enter your address</li>
error.city.required=<li>You must Enter your City</li>
error.state.required=<li>You must Enter your City</li>
error.zipcode.required=<li>You Must Enter your ZipCode</li>
error.action.required=<li>You must click on the next button</li>
errors.header=
errors.footer=
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in Struts Application(Cannot find message resources under key org.apache.strut)