Re: TC 4.0 newbie - servlet app won't run
Have you taken a look at the global web.xml file? It's located in $CATALINA_BASE/conf and contains some default mappings. One of those I believe takes care of finding HelloWorldExample.class for the examples context. At any rate you might find it an interesting read as these settings are available to all the apps. --David On Monday 26 November 2001 01:02 pm, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's
Re: TC 4.0 newbie - servlet app won't run
Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands:
Re: TC 4.0 newbie - servlet app won't run
Just a preemptive question, Mark. Is your servlet's class object really called myservlet.class rather than, say, MyServlet.class? -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles
Re: TC 4.0 newbie - servlet app won't run
Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name
Re: TC 4.0 newbie - servlet app won't run
Okay, Mark, Part III, another question: If you don't put your servlet called myservlet in a package called myservlet as well, why do you use that odd pattern? The pattern looks like you want to use servlet as a package name? I am starting to think that you have some left-over confusion from the old days about referencing servlets in a package called servletor something? Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0
Re: TC 4.0 newbie - servlet app won't run
The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes
Re: TC 4.0 newbie - servlet app won't run (correction)
Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif
Re: TC 4.0 newbie - servlet app won't run (correction)
I will reply, Mark, in bits and drabs, as I try to figure out what you are missing and what you may have wrong. First, the servlets I referred to are not any different as servlets. They are not compiled JSP pages. The are regular old servlets. Compiled JSP page servlets are kept in tomcat/work/. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST
Re: TC 4.0 newbie - servlet app won't run (correction)
I have not looked at the webapps/examples except incidentally, Mark, so I am not sure how the HelloWorldExample servlet is accessed. How you access a servlet and where the servlet is are very important in these contexts. Inside and outside WEB-INF are very different, for example. Inside WEB-INF is dark to the outside world and must be accessed differently than outside WEB-INF. There must, as it were, be a portal. I still have not received answers from my last questions, which I need to go forward in my attempt to see what you may be doing. Certain answers to those questions could resolve everything. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url
Re: TC 4.0 newbie - servlet app won't run (correction)
Mark. I personally work on my sites at a distance, so I am presently ftping the webapps/examples to have a look at them. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 10:15 AM Subject: Re: TC 4.0 newbie - servlet app won't run (correction) Correction, using POST results in a 405-Resource not allowed due to the HelloWorldExample servlet not implementing doPost(). Others do and work fine with POST. My apologies. At 01:02 PM 11/26/2001 -0500, you wrote: The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work
Re: TC 4.0 newbie - servlet app won't run
Mark, I don't have webapps/examples running, so I need to ask you another question. Is there a class file called HelloWorldExample.class in examples/servlets/?, i.e. examples/servlets/HelloWorldExample.class. From what I can tell about your remarks, there should be. I notice that the only reference to any HelloWorldExample.class in the whole example app is in that file. If there is a way to get to the file without a file where the reference is, I don't know how that would happen. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 9:58 AM Subject: Re: TC 4.0 newbie - servlet app won't run The examples you mentioned are the JSPs examples. I realize JSPs compile to servlets, but what about the straight up HelloWorldExample servlet? I didn't see mapping for that or the other servlet (vs. JSP) examples in the web.xml. Being a newbie, I could very well be missing something so please bear with me (again). BTW - I've fiddled with the example servlet index.html to use FORM vs. href=../servlet/abc method of running servlets. POST always results in a 404. GET does however work. Example: FORM ACTION=../servlet/HelloWorldExample method=POST - doen't work FORM ACTION=../servlet/HelloWorldExample method=GET - works. Mark At 09:30 AM 11/26/2001 -0800, you wrote: Okay, Mark, Part II, I want to make sure we are communicating properly before going further. No sense wasting time. Your note is not correct about at least somethings -- for example (no pun intended): The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings. So, I am not sure what you are looking at. The servlet SnoopServlet has the mappings to the patterns /snoop and *.snp under the name snoop. The servlet servletToJsp which has the same name, i.e. servletToJsp, has a mapping to the pattern /servletToJsp. Micael -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 7:00 AM Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under
Re: TC 4.0 newbie - servlet app won't run
Mark, regarding accessing servlets, I will give a few general remarks that may or may not be helpful. I would appreciate knowing either way. -Original Message- From: Mark [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Monday, November 26, 2001 9:58 AM Subject: Re: TC 4.0 newbie - servlet app won't run First, there is more than one way to not only skin a cat but also to access a servlet. Let's look at a non-web.xml way. A.We can do it via URL by prepending the servlet's class name with /servlet/. Thus, we can access it as typically noted by http://localhost:8080/servlet/HelloWorld B.If the servlet if part of a package, then http://[serverroot]:8080/servlet/package.name.HelloWorld, where the servlet is put into server_root/webapps/yourapp/WEB-INF/classes/package/name Note that we have NOT MENTIONED THE web.xml. Okay? I think you are probably actually putting in the servlet reference as a directory or something. Are you? Are you including classes as part of a package name? Something like that must be going on. The directory classes is not part of the classpath. I assume you know that. I keep wondering why you are continuing to use /servlet/ in your web.xml with /servlet/myservlet. It makes me think you might be doing something like actually constructing a servlet directory or something. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: TC 4.0 newbie - servlet app won't run
Look in server.xml. You'll see that it has the following lines: !-- Tomcat Examples Context -- Context path=/examples docBase=examples debug=0 reloadable=true Logger className=org.apache.catalina.logger.FileLogger . It goes on for quite a while longer, but I believe that that's the answer to your question. I'm struggling to understand as a newbie myself... -Original Message- From: Mark [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 10:03 AM To: Tomcat Users List Subject: Re: TC 4.0 newbie - servlet app won't run Thanks for your reply Scott, and thanks to your and Micael's responses I _believe_ I understand the relationship between the servlet naming/mapping and the associated html. As Micael noted, one could put pudding in the url-pattern as long as the html was setup as ACTION=pudding. But... how do the example servlets work when they don't seem to have any servlet mapping in the ..\examples\WEB-INF\web.xml? Even after all the advice, I *STILL* can't get my app to run - I still get a 404 error on the servlet. This seems like such a simple issue but I can NOT get past it. I've even gone as far as downloading Tomcat 3.3, with the same result. Again, I know Tomcat is parsing my web.xml, because if I intentionally make a typo, the parser complains when Tomcat is started. To recap where I am: (a) I have myservlet.class in the $CATALINA_HOME\webapps\myapp\WEB-INF\classes directory. The servlet has no associated package. (b) The html is FORM ACTION=/servlet/myservlet method=POST (c) My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping /web-app Am I still missing something? This is driving me berserk... TIA. Mark. At 12:22 AM 11/22/2001 -0500, you wrote: Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp
TC 4.0 newbie - servlet app won't run
I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: TC 4.0 newbie - servlet app won't run
Your pattern does not occur in your post. So, the pattern will not send the post to the servlet. If you make your post anything and make your pattern anything, that will work. Get my drift? The post is just some text that should match the pattern and that will then refer the app to your servlet. -Original Message- From: Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Wednesday, November 21, 2001 12:39 PM Subject: TC 4.0 newbie - servlet app won't run I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: TC 4.0 newbie - servlet app won't run
Sorry, I'm not following you. What pattern are you referring to? Again, this app (and the html FORM/POST snippet I included) has worked under Forte and VAJ in the past. And I've looked at other Tomcat examples that look very much like what I'm doing, eg. http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html At 01:15 PM 11/21/2001 -0800, you wrote: Your pattern does not occur in your post. So, the pattern will not send the post to the servlet. If you make your post anything and make your pattern anything, that will work. Get my drift? The post is just some text that should match the pattern and that will then refer the app to your servlet. -Original Message- From: Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Wednesday, November 21, 2001 12:39 PM Subject: TC 4.0 newbie - servlet app won't run I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: TC 4.0 newbie - servlet app won't run
I think your problem might be this: servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping AFAIK the url-pattern should be: url-pattern/myservlet/url-pattern to map http:///myapp/myserlvet to you servlet 'myservlet' which is associated with the myservlet class Wouter -Original Message- From: Mark [mailto:[EMAIL PROTECTED]] Sent: 21 November 2001 21:43 To: [EMAIL PROTECTED] Subject: TC 4.0 newbie - servlet app won't run I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: TC 4.0 newbie - servlet app won't run
FORM ACTION=servlet/myservlet method=POST - Original Message - From: Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 22, 2001 04:42 Subject: TC 4.0 newbie - servlet app won't run I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: TC 4.0 newbie - servlet app won't run
Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: TC 4.0 newbie - servlet app won't run
Mark, Scott is right, of course, but there is no reason to use a url when in fact you are just using a tag or a name. It is misleading, in my opinion. In Scott's code, substituting form action=pudding method=post for form action=/servlet/servlet method=post works just as well as long as you use url-servletpudding/url-servlet instead of url-pattern/servlet/servlet/url-pattern. This is not an incidental matter. The latter for gives the mistaken impression that the semantics of url-pattern has something to do with urls, classpath, etc, which it does not. Once you free yourself of the meaningless references to urls in url-pattern you can begin to use it for passing code, keys for the controller servlet, etc. As long as you stick with url-look-alikes, you have misleading code. Typically, a Tomcat Model 2 Architecture uses this possible way of employing and passing free semantics to the controller. The issue, in my opinion, is not a trivial matter in Model 2 design patterns. -Original Message- From: Scott Ahten [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Date: Wednesday, November 21, 2001 9:20 PM Subject: Re: TC 4.0 newbie - servlet app won't runThi Mark, The servlet tag is used to assign a name to a particular servlet class file. servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet This would attempt to assign the name 'myservlet' to the class 'myservlet.class.' The servlet-mapping tag defines the pattern or 'location' of a named servlet from the root of your context. This means that servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping if this were the ROOT context, this would map your servlet at /classes and your form action would need to be defined as FORM ACTION=/classes method=POST A more common mapping for servlets is servlet-mapping servlet-namemyservlet/servlet-name url-pattern/servlet/myservlet/url-pattern /servlet-mapping which would have a coresponding form tag of FORM ACTION=/servlet/myservlet method=POST ~Scott Mark wrote: I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the example servlets, but not my own. My html displays and I can execute my JSPs, but a POST to a servlet does not work (this app has run under Forte and VA Java in the past). I get a 404 error with the requested resource (/myservlet) is not available. Since the examples work, I have to assume it's something in my configuration. Any help figuring out why the servlet won't run would be *greatly* appreciated. I suspect it's something simple/braindead on my part. o My directory structure for the app: TomcatHome | +--webapps | +--myapp\.jsp, .html .gif | +--WEB-INF\web.xml | +--classes\.class files o My html POST stmt. I've tried various path prefixes to myservlet, eg classes/myservlet. As with the Tomcat examples, this servlet has no package: FORM ACTION=/myservlet method=POST o My web.xml - I know Tomcat's seeing/parsing this because if I deliberately make a typo I get an error upon startup: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app !-- Define servlets that are included in the application -- servlet servlet-namemyservlet/servlet-name servlet-classmyservlet/servlet-class /servlet servlet-mapping servlet-namemyservlet/servlet-name url-pattern/classes/url-pattern /servlet-mapping /web-app o Update to server.xml Context path=/myapp docBase=myapp debug=0 Logger className=org.apache.catalina.logger.FileLogger prefix=myapp_log. suffix=.txt timestamp=true/ /Context -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]