• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Servlets on Tomcat 4 (Standalone)

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
Does anyone there succesfuly ran a servlet on Tomcat 4 (standalone).
I am trying, buts it always says not found/available. It was so simple with Tomcat3.2.
I have created a "test" web application, placed it under webapp, also web-inf/web.xml is correctly placed there. I wondering what's the problem.
I have added a entry in server.xml for test context
--------------server.xml entry--------------------
<Context path="/manager" docBase="manager"
debug="0" privileged="true"/>
<Context path="/test" docBase="test" debug="0"
reloadable="true"/>
-------------------------------------------------
------------webapps/test/web-inf/web.xml----------
<!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>
<display-name>Hello, World Application</display-name>
<description>
This is a simple web application with a source code organization
based on the recommendations of the Application Developer's Guide.
</description>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<description>
abc
</description>
<servlet-class>HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
---------------------------------------------

Am I missing something cruicial ??
Thanks in advance
 
Saloon Keeper
Posts: 28486
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the URL you're using http://localhost:8180/manager/HelloServlet?
(your port may vary depending on which Tomcat 4 you installed).
 
Deepak Shah
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tim Holloway:
Is the URL you're using http://localhost:8180/manager/HelloServlet?
(your port may vary depending on which Tomcat 4 you installed).


Tim :
I guess, if port number is wrong, it shall give me "Can not find server". But it gives "The requested resource (/HelloServlet) is not available.".
Thanks
Deepak.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the URL should be http://localhost:8080/test/HelloServlet (not manager)
 
Deepak Shah
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Curwen:
the URL should be http://localhost:8080/test/HelloServlet (not manager)


Yeah, Thats right.
But it is not the problem.
Even with the right url, problem is there !
Deepak
 
Tim Holloway
Saloon Keeper
Posts: 28486
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Curwen:
the URL should be http://localhost:8080/test/HelloServlet (not manager)


Sorry about that - I didn't notice that there were 2 different webapps defined.
You'd be better off to quote the exact error message. A "404 Not found" message indicates that you have a configuration problem. A "Not available may indicate that the application aborted if it's a "550(?)". The other one I can think of is the "not configured to handle this request" message (text VERY approximate) which you would get if the webapp hadn't registered at all.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, if you're using IE, turn off that darn "friendly errors"

Tools|Internet Options|Advanced "Show friendly HTTP error messages" and while you're there, turn off "Show friendly URLs" as well.

This will allow you to see the actual error the server sends you, and not just what Microsoft assumes you can safely handle.
 
Deepak Shah
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim and Mike,
I will have one more round of fight from start ~
Will get back to you.
Deepak.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using this website to run your servlets on a standalone Apache Tomcat servlet engine:
http://www.moreservlets.com/Using-Tomcat-4.html
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak,
The new tomcat is a pain in the ###, isn't it?
In previous versions of tomcat, the invoker servlet was enabled by default. In 4.1.12, it's not. This means a major headache for people upgrading to the new application.
To make things work like they used to, go to install_dir/conf/web.xml and uncomment the servlet-mapping element that maps the invoker servlet to /servlet/*.
A great website you should check out is http://www.moreservlets.com/Using-Tomcat-4.html
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak, I think you will need to make the following changes in your web.xml
.....
<servlet-mapping>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>Servlet/HelloServlet</url-pattern>
</servlet-mapping>

I hope it works.

Originally posted by Deepak Shah:
Hi Guys,
Does anyone there succesfuly ran a servlet on Tomcat 4 (standalone).
I am trying, buts it always says not found/available. It was so simple with Tomcat3.2.
I have created a "test" web application, placed it under webapp, also web-inf/web.xml is correctly placed there. I wondering what's the problem.
I have added a entry in server.xml for test context
--------------server.xml entry--------------------
<Context path="/manager" docBase="manager"
debug="0" privileged="true"/>
<Context path="/test" docBase="test" debug="0"
reloadable="true"/>
-------------------------------------------------
------------webapps/test/web-inf/web.xml----------
<!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>
<display-name>Hello, World Application</display-name>
<description>
This is a simple web application with a source code organization
based on the recommendations of the Application Developer's Guide.
</description>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<description>
abc
</description>
<servlet-class>HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
---------------------------------------------

Am I missing something cruicial ??
Thanks in advance

 
Ranch Hand
Posts: 147
Android Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Dehoney:
Hi Deepak,
The new tomcat is a pain in the ###, isn't it?
In previous versions of tomcat, the invoker servlet was enabled by default. In 4.1.12, it's not. This means a major headache for people upgrading to the new application.
To make things work like they used to, go to install_dir/conf/web.xml and uncomment the servlet-mapping element that maps the invoker servlet to /servlet/*.
A great website you should check out is http://www.moreservlets.com/Using-Tomcat-4.html


David!!! You are my hero. I've been banging my head against the wall for a couple of hours. I've been trying to get a HelloServlet to run from install/webapps/ROOT/WEB-INF/classes.
Uncommenting the servlet-mapping element that maps the invoker servlet to /servlet/* was exactly my problem, so thanks!
By the way, for anyone else...follow the More Servlets Using Tomcat link and look for "Configure Tomcat". (I missed that at first glance)
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic