5

I am getting the following error in the browser window :

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE

I have included the resource file in the struts-config.xml using

And my resource file is stored as WEB-INF/classes/Application.properties file.

Lokesh Sah
  • 2,283
  • 5
  • 23
  • 33

7 Answers7

2

Well this is an old post, but my answer can help, I guess... I personally wasted some time to make work a poject that had been developped under Tomcat 5.5 under Tomcat 7.

Note : You should name your ressource file : "ApplicationResources"...

There is several reasons why it wouldn't work, but the most common answer I found on the net was : put the line

<message-resources parameter="ApplicationResources" null="false" />

in your "struts-config.xml".

In my case, this line was already present, and this was the contrary : I had to remove it and replace at the "web.xml" file level by :

    <context-param>
        <param-name>application</param-name>
        <param-value>ApplicationResources</param-value>
    </context-param>

in the "servlet" tag.

I'm sorry that I don't have a valuable explanation for this, but my application behaves just fine now. Does anyone has (an explanation) ?

Gauthier Boaglio
  • 10,054
  • 5
  • 48
  • 85
1

This happened to me because I was converting my project to maven and my resources directory was not correct.

I had struts-config.xml like this:

<message-resources parameter="messages.appResources" null="false"/>

My pom.xml was like this:

        <resource>
            <directory>src/main/resources</directory>
        </resource>

But my messages folder was in my project root. So I moved it to:

${project.basedir}/src/main/resources/messages
Jess
  • 23,901
  • 21
  • 124
  • 145
1

Make sur that you are using the same version of the DTD in the header of struts-config.xml:

I had this error when using two differents versions:

//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

and the Pb was solved once the correction made:

yagami97
  • 11
  • 1
0

The following solved my problem:

In Struts Config, include:

(At the top)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

<message-resources
    parameter="common.properties.Common" /> (or the path to your resources file)

This error seems to be caused by a lack of a path to message-resource in struts-config.xml and the DOCTYPE definition at the top of the same.

0

you should put this line in your struts-config.xml

< message-resources parameter="ApplicationResources" null="false" key="ApplicationResources" />

0

In my case problem was fixed after delete all unnecessary attributes from message-resources element in struts-config.xml file. Just like following:

<message-resources parameter="ApplicationResources"/>
Kerim
  • 115
  • 2
  • 12
0

An XML might be missing... In which context is your application running ? Tomcat ? JBoss ?

Try including xalan and xerces dependencies.

chrisnfoneur
  • 401
  • 1
  • 5
  • 11