No Title

I’ve been trying to get started using Struts for my JSP/Servlet
work. I’ve been farting with this for a week and I still find it
incredibly difficult to actually do things with it. It is very ticky
about how you configure it, and the slightest deviation will cause it
to silently not work right. Well, not quite silently but without
actually telling you what the real problem is (like that your
configuration options must be specified in a certain order or it won’t
work.) Employers who offer jobs that I like are more and more asking
for this, and having read up on it theoretically it sounds very cool
and good. However, this getting started is a huge and frustrating pain
in the ass. I decided to stop farting with my project that woun’t load
and work through a tutorial I found. It all worked until I got to step
2, using the bean:message tag to move the text to resource
bundles. Although I followed every step exactly, I get the
org.apache.jasper.JasperException: Cannot find message resources
under key org.apache.struts.action.MESSAGE
when I try to load
the page. I’m sure I’m missing something simple and once I learn it
I’ll know it forever but it is really pissing me off right about now.

8 Replies to “No Title”

  1. It could be a problem in your struts-config.xml.

    You’ll want to make sure the following line is present and correct:

    (where “com.test” is your own package name)

  2. Hmm, the message system here doesn’t like xml. Try again:

    <message-resources parameter=”com.test.ApplicationResources”/>

    (where com.test is your own package name)

  3. BD, Thanks. I actually did have that set although I’m not 100% sure that I had the struts-config.xml correct. I’ve found that thing very hard to work with and noticed in the error logs that I was getting XML errors on load. It’s been a few months since I worked with this project but I’m just climbing back on board so I’ll give this a good shakedown. I’m going to try using Eclipse with the Tomcat plugin so I can if necessary step through the load and make sure it is all right.

  4. here is my struts_config.xml: Can you please send me email with your response?

    Sara

    < ?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">




    ===========================================================
    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">


    action
    org.apache.struts.action.ActionServlet
    application “***.****.ApplicationResources”

    config /WEB-INF/struts-config.xml

    debug 2

    detail 2

    validate true

    2



    action
    *.do


    invoker
    /servlet/*



    index.jsp
    index.html




    /WEB-INF/struts-bean.tld


    /WEB-INF/struts-bean.tld



    /WEB-INF/struts-html.tld


    /WEB-INF/struts-html.tld



    /WEB-INF/struts-logic.tld


    /WEB-INF/struts-logic.tld



    /WEB-INF/struts-template.tld


    /WEB-INF/struts-template.tld

  5. Since a fair number of folks who hit this site are here from googling on this error, I just thought I would try to close this out. My issue was ultimately as BD suggested, failure of my struts-config to validate. Struts has a very ticky DTD for the config file, such that you can’t put things in the wrong order or do other things that don’t feel harmful but will prevent it from working.

    The best way I have found to deal with this is to us by frequently testing everything with StrutsTestCase. This will immediately expose problems, whether from the config being invalid, the forwards not being set up right, or the logic of your code being off. Plus, it lets you test without all the headache of compile/build/deploy/reload. I’m using it directly from Eclipse, and since I’m still feeling my way through Struts and I frequently need many shots to get it right, this is a lifesaver. It takes about 10% of the time to test if things are working this way versus actually running it. HIghly recommended.

  6. I have the same problem. The only thing is that (I’m assuming we’re talking about the same tutorial – StrutsTrailMap) the tutorial did not mention anything regarding the struts_config.xml file for this part of the tutorial. From my understanding, this part of the tutorial don’t need the struts_config.xml since it relies on the web.xml to source out the resource.

  7. Simone,

    I don’t remember specifically what tutorial I was trying to get working. After I had given up and let it rest awhile, when I came back to it after a few weeks away, I found my Tomcat logs full of errors from my previous stint, all validation errors at the very tail of my web.xml (I think – it’s hard to remember after 6 months). It appears like everything prior to the errors was working, and everything that was after simply went unconfigured in Tomcat. My error was a DTD violation, by having something out of order.

    Sorry I don’t have better information, but this is all I can remember. I’d recommend if you see these type errors, check the log files to see if you have config load problems that are getting thrown there.

  8. hi,
    i m facing this error from last 1 week…..can u plz help me out….i hav mentioned the path of ApplicationResources bundle in environment PATH variable and i have initialized that in web.xml also but then also same error is coming……The complete error is:
    org.apache.jasper.JasperException:Cannot find message resources under key org.apache.struts.action.MESSAGE….
    and the root cause is:
    javax.servlet.ServletException:Cannot find message resources under key org.apache.struts.action.MESSAGE….
    Regards,
    Harit.

Comments are closed.

No Title

Long back in the mists of time, back in 1994, I first started using
the WWW. One of the first, possibly *the* first site I browsed
regularly (and this is back with lynx, mind you) was that of Steve Jackson Games Daily
Illuminator
. SJG is of note in the cyberworld as being the victims
of the Secret Service’s raid when they were working on a game called
Hacker. They are longtime dorks, and one thing they did way back when
was start Io.com (aka “Illuminati Online”,
which seems to be repurposed as a grown up web hosting company
now). At the time, I would use my shell dialup at work, browse via the
vibrant text of lynx and read up on projects like
Illuminati: New World Order
and other stuff. Now I find that, of course, the Daily Illuminator is
offered by RSS
feed
. Fits, don’t it? I like their games but I’m a classic “buy
them but don’t play them” type. I own plenty of INWO cards but have
only played a few times in the last eight years, mainly because I have
few friends with whom I can play dork games. I looked at the Daily
Illuminator today for the first time in years, and just grinned when I
saw the XML link. I added them to my Zoe aggregator, what the hell.