aspose file tools*
The moose likes Struts and the fly likes Struts on TomCat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts on TomCat" Watch "Struts on TomCat" New topic
Author

Struts on TomCat

amol mathur
Greenhorn

Joined: May 28, 2001
Posts: 6
Hi all
i put up a asimple struts application on tom cat but it gives the following error.
Hope u guys can help me with this.
Thanks in advance
Amol Mathur.
/************************************************************/
javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
at org.apache.jsp.StrutsTest$jsp._jspService(StrutsTest$jsp.java:333)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)

root cause
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.struts.util.RequestUtils.message(RequestUtils.java:568)
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)
at org.apache.jsp.StrutsTest$jsp._jspService(StrutsTest$jsp.java:208)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
/************************************************************/
jayram
Ranch Hand

Joined: Oct 30, 2000
Posts: 94
i am not sure how relevant this is but
but
1. Have u modified <servlet>,<servlet-mapping> elemnts in web-xml to provide proper mapping for controller servlet
2. Have u created struts-config.xml file to define the action mappings?
These were the things which i had missed while my first attempt at struts. I would go back to my struts installation and find out what might be wrong..

Which tomcat version are u using??
Cheers
Jayram
------------------
What if this is as good as it gets ?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

You might also want to make sure that the various *.properties files that Struts uses (e.g. ApplicationResources.properties) is reachable via the classpath.
Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]
sridhar satuloori
Ranch Hand

Joined: Nov 05, 2001
Posts: 144
Try putting struts.jar in classpath
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
It's the ActionServlet which is responsible for setting up your MessageResources (ActionServlet.initApplication()). So, first, are you loading the ActionServlet on startup (load-on-startup in web.xml as per the instructions) and second, does the ActionServlet log any errors? Make sure the location of your messages file is correct (application parameter in web.xml). Enable debugging (debug and detail parameters in web.xml) if you get stuck.
Neither struts.jar nor the message bundle should reside in the classpath; many application servers ignore the classpath anyway. Put them under WEB-INF/lib and WEB-INF/classes of your web-app respectively. I'm sure that is what Junilu meant.
- Peter
[This message has been edited by Peter den Haan (edited November 08, 2001).]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Thanks, Peter. Actually, I answered based on my experience in using Struts in VisualAge for Java WebSphere Test Environmetn(WTE). I have to add the directory where the .properties files are to the classpath in order for Struts to find it. I haven't had the chance to work on the deployment to WAS but I thought that you had to do the same thing in that environment as well. I haven't used Struts in any other environment though so YMMV.
Junilu
Jon Wilson
Greenhorn

Joined: Oct 15, 2003
Posts: 14
If you are getting the following message...
javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
-OR-
503 servlet action unavailable
...check your localhost_log file found in /usr/local/tomcatx/logs/localhost_log.2003-xx-xx.txt for errors. In my case, I had parsing errors in struts-config.xml


Mensa member, Certified bartender, Created the Internet (along with Al Gore), Speak 9 languages fluently (this includes pig latin), Spelling Bee Winner, 8th Grade Math Award, Can hold breath under water for more than 2 minutes
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

Ummm, Jon...
appreciate your trying to be helpful, but it isn't really necessary to respond to posts that are over 2 years old.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
zhang jerry
Greenhorn

Joined: Nov 25, 2003
Posts: 2
frist, check <message-resources> in the your struts-confing.xml
second, check ApplicationResources.property file


Jerry zhang
Jon Wilson
Greenhorn

Joined: Oct 15, 2003
Posts: 14
Bear,
It doesn't matter if the original post was 2 years old; people are still having the same problem in current releases of Struts and so my post is still relevant. You are making the assumption that everyone arrives at these posts by browsing through the javaranch forums daily. You are forgetting that many people arrive at these forums by search engine so they don't care how old the post are; they will view your post if that's what Google returns in the search results...And, btw, you suck! ;-P
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

That's a valid point (which I think would have had more impact without the crass comment). I stand corrected.
In any case, in the time since the original topic was posted, a forum devoted to Struts has been created, so I'm moving this topic there.
bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts on TomCat