• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with Struts

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, is anyone interested in giving me a hand with Struts? I've followed a couple of examples but I can't get them to work, I'm using Tomcat 4. I posted on the Struts mailing list, but all I got back was a rude reply, so if anyone wants to correspond with me via email it would be most appreciated, let me know and I'll post my email address.
Thanks.
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this forum is for exactly this kind of thing. Why deprive people of the opportunity to learn from your problems being solved?
 
Sharon Cowling
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm working through a really basic sample application I found on the web
I've followed the instructions, but seem to have gone wrong somewhere, but I'm not sure where!
I thought maybe someone has come across the same error, it may be a configuration problem. I'm using Tomcat 4, and Struts 1.0.2. The struts-config.xml looks correct to me, I've added that at the bottom of the post.
Below is the error message I get when clicking the submit button on the sample app:
Let me know what further information you need from me.
Apache Tomcat/4.0.4 - HTTP Status 500 - No action instance for path /submit could be
created
--------------------------------------------------------------------------------
type Status report
message No action instance for path /submit could be created
description The server encountered an internal error (No action instance for path
/submit could be created) that prevented it from fulfilling this request.
struts-config.xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config (View Source for full doctype...)>
- <struts-config>
- <!-- ========== Form Bean Definitions =================
-->
- <form-beans type="org.apache.struts.action.ActionFormBean">
<form-bean name="submitForm" type="hansen.playground.SubmitForm" />
</form-beans>
- <!-- ========== Action Mapping Definitions ============
-->
- <action-mappings type="org.apache.struts.action.ActionMapping">
- <action path="/submit" type="hansen.playground.SubmitAction" name="submitForm" input="/submit.jsp" scope="request">
<forward name="success" path="/submit.jsp" />
<forward name="failure" path="/submit.jsp" />
</action>
</action-mappings>
</struts-config>
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We actually have a Java Frameworks Forum now. This topic may do better there if someone would want to move it.
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True enough, Gregg. Lets go to Java Frameworks!
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your webapp directory structure look like?
 
Sharon Cowling
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My directory structure is:
D:\Apache Tomcat 4.0\webapps\myproject\
META-INF
WEB-INF
index.jsp
submit.jsp
 
Sharon Cowling
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm going to try this example:
http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts
As it is on the javaranch forum, I figure some of you guys will be familiar with it, so I'll give it a go and post if I strike problems, or have any questions in regards to it.
I really want to use Struts for an internal application at work, but I want to see a working example that I have created first.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sharon Cowling:
My directory structure is:
D:\Apache Tomcat 4.0\webapps\myproject\
META-INF
WEB-INF
index.jsp
submit.jsp


What is in your WEB-INF folder? Is you action class located in the classes folder?
 
Sharon Cowling
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
D:\Apache Tomcat 4.0\webapps\myproject\WEB-INF\classes\hansen\playground\
SubmitAction.class
SubmitForm.class
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sharon Cowling:
Hi,
I'm going to try this example:
http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts


I'm the author of that article so if you have any problems just post them here and I'll try to help.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working my through the struts example. (Actually multiple examples) and not one seems to be working under Tomcat 4.1. Currently the example Thomas Paul is getting me the farthest along, but still have (hopefully just one) problems. The current exception is:
I have a feeling that this has something to do with MessageResources.properties but can't figure out how. Any insight would be greatly appreciated.
org.apache.jasper.JasperException: /jsp/LoginView.jsp(7,13) Unable to load class message
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:417)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:717)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:808)
at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:219)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
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:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
 
Jeff Born
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I may have figured out my previous question:
both .jsp files have struts:message tags. If I change those tags to bean:message tags, then I stop getting the previous exception, but instead I get the following:
org.apache.jasper.JasperException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
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:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Unknown Source)
[ September 27, 2002: Message edited by: Jeff Born ]
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The struts:message tags are correct. Make sure you have this at the start of the jsp:
<!-- LoginView.jsp -->
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And make sure your WEB-INF is capitalized. Tomcat does weird things if it isn't.
 
Jeff Born
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked WEB-INF and it looks capitalized to me. I did have WIN-INF at a very early stage and weaseled that WIN and WEB are not the same thing. I could have some residule effects, but can't seem to find any. I am using eclipse 2.0 with a Tomcat plugin, but have the same results if I project contents to the webapps directory and remove the context reference in the server.xml.
Thomas I have a small war file that I would like to email with everything. Should I do that or just add all the files?
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeff Born:
Thomas I have a small war file that I would like to email with everything. Should I do that or just add all the files?


Send it along and I'll take a look.
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that you have a struts.tld file. Some of the nightly distributions seem to be missing that one.
 
Jeff Born
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright it looks like I had two problems:
1: I redownloaded (it that a word?) struts.
2: in the web.xml I referenced MessageResources.properties when I should have referenced just "MessageResources" I made this change while trying to rule things out earlier and forgot to change it back.
Many thanks to Thomas for helping out!
jb
 
Jeff Born
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I thought I was done... I have successfully displayed the LoginView.jsp I have even stepped into some of the code via Eclipse 2.0 with a Tomcat plugin. However my login bean object seems to be disappearing. I can step through the LoginBean's setParameters. I can see admin being set to both parameters. However when I get to the validate method userId and passWord are no longer set. Both are null and I receive a NullPointerException when stepping over (!userId.equals(passWord)) I get this error when running from both the Eclipse workbench and from starting Tomcat 4.1 from the services control panel.
On a side not Eclipse 2.0 stepped correctly the first time through the application. On subsequent debugging attempts F6 put me back into run mode, not step over? Anyone see this behavior?
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeff Born:
Well I thought I was done... I have successfully displayed the LoginView.jsp I have even stepped into some of the code via Eclipse 2.0 with a Tomcat plugin. However my login bean object seems to be disappearing. I can step through the LoginBean's setParameters. I can see admin being set to both parameters. However when I get to the validate method userId and passWord are no longer set. Both are null and I receive a NullPointerException when stepping over (!userId.equals(passWord)) I get this error when running from both the Eclipse workbench and from starting Tomcat 4.1 from the services control panel.
On a side not Eclipse 2.0 stepped correctly the first time through the application. On subsequent debugging attempts F6 put me back into run mode, not step over? Anyone see this behavior?



Check your LoginBean code to see if the data type is listed for the variables in the setParameters method. If it is, remove it so that it will set the instance variables instead of setting the variables as local variables.
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Matthew Phillips:
Check your LoginBean code to see if the data type is listed for the variables in the setParameters method. If it is, remove it so that it will set the instance variables instead of setting the variables as local variables.

I had fixed that but then somehow managed to save the old one back to the server. :roll: Anyway, it's fixed again.
 
Jeff Born
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was the problem. Thanks again to everyone for all their help.
jb
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic