Hi,

I was wondering if someone could help me with this problem that I have.
I am trying to get a simple Hello World struts application to run and I
keep getting this error:

org.apache.jasper.JasperException:
Cannot find message resources under key org.apache.struts.action.MESSAGE

I have tried running the web application under these two configurations:
   Tomcat Version: Apache Tomcat/4.1.29
   JVM Version: 1.4.2_02-b03
   JVM Vendor: Sun Microsystems Inc.
   OS Name: Windows XP (Pro)
   OS Versin: 5.1
   OS Architecture: x86
and
   Tomcat Version: Apache Tomcat/4.1.27
   JVM Version: 1.4.2_01-b06
   JVM Vendor: Sun Microsystems Inc.
   OS Name: Linux (Red Hat 9)
   OS Versin: 2.4.20-8smp
   OS Architecture: i386

I get the same error message under both versions.  I have tried searching
the Internet for reasons as to why this would occur.  I have tried putting
the properties file in a package and jar'ing it up and using that to
reference the resource bundle, and I received the same error message.

If I don't use the bean:message to output the keys of the resource
bundle and simply use the html:html and html:base, the output works fine.
The minute I try to use a resource bundle, then I get the error message.
It is almost as though the bean can't find the resource bundle at all.

If anyone can help me or see something that I am missing, I would
really appreciate it.

Thanks.

---------------------------------------------------------------------
Here is the directory structure of the web application:
/hello.jsp
/WEB-INF/web.xml
/WEB-INF/struts-config.xml
/WEB-INF/classes/HelloWorldMessageResources.properties
/WEB-INF/lib/struts.jar
/WEB-INF/tlds/struts-bean.tld
/WEB-INF/tlds/struts-html.tld

---------------------------------------------------------------------
Here is the hello.jsp file:
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>

<html:html>
  <head>
    <title><bean:message key="title.helloworld"/></title>
    <html:base/>
  </head>
  <body>
    <h1><bean:message key="label.helloworld"/></h1>
  </body>
</html:html>

---------------------------------------------------------------------
Here is the struts-config.xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config
    PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
    
<struts-config>
  <message-resources parameter="HelloWorldMessageResources" null="false"/>
</struts-config>

---------------------------------------------------------------------
Here is the web.xml file:
<?xml version="1.0"?>
<!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>
  <display-name>Hello World Application</display-name>
  
  <description>
    This application simply displays the phrase "Hello World!"
  </description>
  
  <servlet>
    <servlet-name>helloworld</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>HelloWorldMessageResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
  </servlet>
  
  <welcome-file-list>
    <welcome-file>hello.jsp</welcome-file>
  </welcome-file-list>
  
  <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-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
  </taglib>
</web-app>

---------------------------------------------------------------------
Here is the HelloWorldMessageResources.properties file:
# Page Titles
title.helloworld=Hello World

# Labels
label.helloworld=Hello World!


Richard Morris
[EMAIL PROTECTED]

Reply via email to