my dog learned polymorphism*
The moose likes Tomcat and the fly likes What's wrong with me? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "What Watch "What New topic
Author

What's wrong with me?

Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
i used tomcat 3.2.3 at home for half year and everything was fine. my system administrator
put tomcat 4 at our apache server and i can't find the reason for the fact that i don't succeed to run servlets on it! i do everything as i've done earlier,but it just doesn't work.
i opened a "classes" directory at
"..tomcat-install-directory.."/webaps/ROOT/WEB-INF
but the servlets i deploy there do not run.
i just get a message that the file were not found
. it looks like the path behaves like relative
domain for the machine... any suggestions?


Asher Tarnopolski
SCJP,SCWCD
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
by the way, the servlets in the examples directory
are running ok.
come on guys, any ideas?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

by "the servlets i deploy " what do you mean? Have you written up a web.xml for this webapp, and all your mappings are in place?

You said: "it looks like the path behaves like relative domain for the machine". I don't understand that I'm afraid.

And what is the *exact* URL you are trying to load, and what is the error message?
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
ok,i'll try to explain it once more (took an english dictionary )
under the "servlets i deploy" i mean the servlets i've written and placed in webapps\ROOT\WEB-INF\classes directory.
i didn't make any changes in the web.xml file.
actually i used to use tomcat 3.3 and i don't remember myself changing it either. (is there any one-time change i should make there to run servlets?:confused
actually i didn't see any mappings to the webapps\examples\WEB-INF\classes but the rexample servlets in it run ok...
the url i try to load looks like www.zbc.de/servlet/TheServlet and what i get is apache's 404 error like this:" The requested resource (/servlet/TheServlet) is not available."
can you help me now?
10X.
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260

i wanted to write i run the url like this:
www.xbc.de:8080/servlet/TheServlet
sorry
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I've never used the 'anonymous servlet' feature of Tomcat, as it is somewhat non-standard across servlet runners.

there's a pretty good explanation of what it is in the web.xml file in <CATALINA_HOME>/conf/web.xml

I've examined my own on my home system, and it appears to be 'on' and enabled.

Are you running Apache web server in front of Tomcat ? If you are, trying going right to port 8080 of Tomcat, and see if it will serve your servlet to you.

Also, I'd try putting the servlet in a proper web application, and not use the anonymous /servlet/* mapping provided by Tomcat. It's the more appropriate way of doing things anyways (in my view). This is how: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/deployment.html

As an off-the-wall, crazy last suggestion, have you tried http://yourdomain.com/ROOT/servlet/myServlet ?
[ January 19, 2002: Message edited by: Mike Curwen ]
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260

well,may be this will help...
i found this in the web.xml file on the "problematic" machine :
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mapping for the invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
on the machine where i don't have any problems running tomcat there is no part of 'default servlet' but only 'invoker' one.
i don't have a clue if there is any difference between the two. but still,can this make THE difference?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Read what it says for that serlvet...My file has this mapping, so no, that's not the problem.
Deepak Shah
Ranch Hand

Joined: Nov 29, 2000
Posts: 97
Hi Guys,
I guess I am facing similar problems.
I created a new web app (test) with proper web.xml file.
<!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>
Also added a context entry in server.xml:
<Context path="/test" docBase="test" debug="0"
reloadable="true"/>
Trying to run the simplest server "HelloWorld" but it says (/HelloServlet) is not available.

Some problem is there for certain
Deepak
Takeshi Toyohara
Greenhorn

Joined: Feb 03, 2002
Posts: 21
Hey all,
I'm having a similar problem.
The following is the only url-pattern i can get this to run as. Any other pattern i try fails.

Here's my entire web.xml


does anyone know why I am stuck with that one url-pattern? the other patterns in the built-in examples seem to work fine for some reason!?!?
thanks mucho
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Are you putting the name of the webapp in the requested URL?

http://<hostname>:<port>/<webapp name>/<url pattern>

where webapp name is the folder name under webapps in which your application resides.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The ability to ask Tomcat for a servlet not explictly named in the web.xml (no wildcards) I believe was omitted from Catalina. I don't know about modern-day Tomcat 3 versions.
I think there are two reasons why it wasn't a good idea in the first place. One is just basic security - you are now limited to only being able to talk to classes that are explicitly authorized.
I forget the other. It may be related. I suspect that if you're using an architecture where servlets forward to other servlets they could be abused if they could be invoked directly by a malicious client.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's wrong with me?