aspose file tools*
The moose likes Struts and the fly likes Can not find message resources under key org apache struts action MESSAGE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can not find message resources under key org apache struts action MESSAGE" Watch "Can not find message resources under key org apache struts action MESSAGE" New topic
Author

Can not find message resources under key org apache struts action MESSAGE

Jun Chen
Greenhorn

Joined: Feb 23, 2004
Posts: 9
Hi! all,
I am trying run one of my first few Struts framework applications. I got the following error. Can somebody help me out?
<Mar 1, 2004 4:41:08 PM EST> <Error> <HTTP> <101017> <[ServletContext(id=2227270
,name=FirstStrutsApp,context-path=/FirstStrutsApp)] Root cause of ServletExcepti
on
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestU
tils.java:1103)
at org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043)
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:2
94)
at jsp_servlet.__index._jspService(__index.java:125)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1058)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:401)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:306)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:5445)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:780)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3105)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2588)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
>
Following is my web.xml and struts-config.xml
*****web.xml*******
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</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>2</load-on-startup>
</servlet>

<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/do/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>

<!-- Session Timeout Information -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>

<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-form.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>

******struts-config.xml******
<?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">
<!--
This is the Struts configuration file for the example application,
using the proposed new syntax.
NOTE: You would only flesh out the details in the "form-bean"
declarations if you had a generator tool that used them to create
the corresponding Java classes for you. Otherwise, you would
need only the "form-bean" element itself, with the corresponding
"name" and "type" attributes.
-->

<struts-config>
<form-bean>
<form-bean name="bookForm" type="com.bmw.trs.example.Book"/>
</form-bean>

<global-forwards>
<forward name="bookCreated" path="/BookView.jsp"/>
</global-forwards>

<action-mappings>
<!-- Edit user registration -->
<action path="/createBook"
type="com.bmw.trs.example.BookAction"
name="BookForm"
scope="request"
input="/CreateBook.jsp">
</action-mappings>
</struts-config>
Thank you in advance!
lee anthony
Ranch Hand

Joined: Jan 23, 2004
Posts: 35
i beleive it is becaz of web.xml might not be pointing to the right
resorce property , do check might help u
what i suggest is remove the resource file from the current file , then check the same flow if the error still persists then i am right by making the first statemet
regards
lee
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
You could also place resource references in the Struts-config.xml. This is where I place all of mine. Doing so means you can then use the "bundle" attribute for the bean:message tag for multiple bundles. Leaving out the "bundle" tag uses the default.
This also keeps my web.xml more generic allowing me to customize between projects using mainly the struts-config.xml file.
Jun Chen
Greenhorn

Joined: Feb 23, 2004
Posts: 9
Guess what? I missed a '/' char in the <action> </action> tag.
Thank you anyway.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not find message resources under key org apache struts action MESSAGE