aspose file tools*
The moose likes Tomcat and the fly likes Servlets on Tomcat 4 (Standalone) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlets on Tomcat 4 (Standalone)" Watch "Servlets on Tomcat 4 (Standalone)" New topic
Author

Servlets on Tomcat 4 (Standalone)

Deepak Shah
Ranch Hand

Joined: Nov 29, 2000
Posts: 97
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
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16054
    
  21

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


Customer surveys are for companies who didn't pay proper attention to begin with.
Deepak Shah
Ranch Hand

Joined: Nov 29, 2000
Posts: 97
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.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

the URL should be http://localhost:8080/test/HelloServlet (not manager)
Deepak Shah
Ranch Hand

Joined: Nov 29, 2000
Posts: 97
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

Joined: Jun 25, 2001
Posts: 16054
    
  21

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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Nov 29, 2000
Posts: 97
Thanks Tim and Mike,
I will have one more round of fight from start ~
Will get back to you.
Deepak.
Shuaib Gill
Ranch Hand

Joined: May 29, 2001
Posts: 62
Try using this website to run your servlets on a standalone Apache Tomcat servlet engine:
http://www.moreservlets.com/Using-Tomcat-4.html


programmer77
David Dehoney
Greenhorn

Joined: Oct 18, 2002
Posts: 1
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
dawa
Greenhorn

Joined: Oct 09, 2002
Posts: 1
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


DLS
Glen Tanner
Ranch Hand

Joined: Apr 16, 1999
Posts: 147

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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlets on Tomcat 4 (Standalone)