WhatIf
WhatIf

Reputation: 653

tomcat server not found

I'm trying to configure a tomcat server to start developing servlet/jsp but I get server not found. Here is what I did so far:

Added CLASSPATH to .bash_profile and my servlet compiled successfully.

I typed which java which outputted /usr/bin/java

I then added export JAVA_HOME=/usr/bin/java to .bash_profile

Removed the comments around servlet-mapping as well as the Invoker.

Changed the permission of /usr/share/tomcat6/webapps to world access.

Logged out as root and then logged into my regular account to create WEB-INF/classes under /usr/share/tomcat6/webapps

I then moved the .class from the servlet I compiled to /usr/share/tomcat6/webappsWEB-INF/classes

started a terminal, su to service tomcat6 start then switched user to my normal account and type service tomcat6 status, the output was tomcat 6 running.

Finally, I started my web browser type localhost:8080/servlet/first
and I got server not found. Tried localhost:8080, server not found; however, if I type 127.0.0.1:8080/servlet/first or 127.0.0.1:8080, I get a white page with no error message.

The servlet first will only output Hello World.

I couldn't find the Context path="" docBase="" reloadable="true" line in server.xml

I also search in context.xml, web.xml, and tomcat-users.xml and couldn't find it.

Any suggestions please?

I created a web.xml file inside /usr/share/tomcat6/webapps/WEB-INF, which contains the following lines:

<?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-name>first</servlet-name>
<servlet-class>first</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>first</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>

Still I get server not found. Any thing else I should try?

Upvotes: 1

Views: 1424

Answers (1)

B.Kaatz
B.Kaatz

Reputation: 181

From what you've said, it sounds like you are trying to run the servlet off of the ROOT webapp of the server.

If so, then the question would be: Do you have an /etc/tomcat6/Catalina/localhost/ROOT.xml file?

Or, more to the point, what do you have under /etc/tomcat6/Catalina/localhost/ as far as *.xml files? That is the location for the individual webapp configuration files as far as putting in the Context entry with the docBase configuration.

Hope that helps. Let us know.

Upvotes: 1

Related Questions