File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Help - Can't get Servlets working! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help - Can Watch "Help - Can New topic

Help - Can't get Servlets working!

Con Lu
Ranch Hand

Joined: Aug 27, 2002
Posts: 38
I seem to be able to start up Tomcat okay, but my browser does not seem to access the default Tomcat home page, or any other servlet classes. Note that I am a beginner in Web technology.
I have installed and tested Tomcat 4.0.1 on Win 2000Prof with the following procedure:-
1)Installed JDK1.4 on my machine
2)Installed the Jakarta-tomcat-4.0.1.exe files to directory called d:\Tomcat
3)Set the environment variable CATALINA_HOME to d:\Tomcat
4)Set the JAVA_HOME variable to d:\j2sdk1.4.0
5)Changed the classpath to include d:\Tomcat\common\lib\servlet.jar
6)Opened up a DOS prompt and gone to d:\Tomcat\bin
7)Typed echo %JAVA_HOME% and echo %CATALINA_HOME% to check the variables are correctly set
8)Typed the command startup which starts Tomcat in a separate window
9)I open my Internet Explorer 5 browser
10)I type in http://localhost:8080
11)Instead of getting the default Tomcat page I get a page similar to the following:-
Index of
NameLast modifiedSize
12)When I add any other input to the url in 10) above such as http://localhost:8080/index.html as directed in a Wrox text book, my browser prompts me to connect
13)After connecting the lower right hand side of my browser shows that I am on a local intranet, but all that comes up is a “Page cannot be found error”
14)I have tried the SCWCD Manning book examples by doing the following :-
15)After restarting Tomcat I try to type in http://localhost:8080/chapter01/servlet/HelloWorldServlet
16)Again my browser asks me to connect so I do
17)Once connected I again get a “Page cannot be found error”
Other queries/info which may relate in solving the above:-
1)I don’t know if this is related but when I shutdown a error is shown on my screen with a large stack trace that goes through from top to bottom as follows:-,,
sun.reflect.NativeMethodAccessorImpl, sun.reflect.DelegatingMethodAccessorImp.invoke()
2)Furthermore, I don’t know if this is of any significance, but I have previously installed Oracle9i on my computer which automatically installed what appears to be Apache HTTP server. Could this be causing some sort of conflict?
I have been tearing my hair out trying to solve this problem. Any help would be very much appreciated.
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
Http from Oracle sure might have caused the problem you are facing. i suggest you reinstall Tomcat again. And stop the HTTP Server that might have been runnig as windows starts. And Start your
Tomcat. Try http://localhost:8080, should work.
good luck.

Con Lu
Ranch Hand

Joined: Aug 27, 2002
Posts: 38
How do I disable the Oracle HTTP server?
Could it be that this server is operating on the 8080 port?
How can I change / check ports on the Oracle HTTP server and the Tomcat server?
Also what does does the index page at 11) in my original query mean - does any of it look familiar?
Thanks for your help,
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
If your OS is Windows 2000, you can stop Oracle HTTP like following:
control panel-->Administrative Tools-->Service
then you can get it start manually instead of when it start as Windows starts. You can stop it.
hope it helps.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The listing on page 11) might be Oracle's Apache httpd process responding to your request.

Somewhere in your catalina.out file, you should have a "NetBindException (Address in use): 8080"

I *think* that's the message, I'm typing that from memory.

Also, in regards to having to click 'connect' all the time, read this thread:
Gill Clover

Joined: Aug 10, 2002
Posts: 28
Hi there,
If stopping the Oracle Apache HTTP server hasn't solved your problems, I'd advise changing the port Tomcat listens on to a port you know no other service is using (say, 8000). You do this in the server.xml file found in the conf folder within your tomcat home directory. Make a copy of the server.xml file before you do this just in case!
You're looking for the comment:
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
<Connector className= "... port="8080"... />
Change the port number in this connector className line to the port you want instead (8000?).
Obviously now when you're accessing servlets you must use URL http://localhost:8000/.../...
If you're still having no luck after this, there's a chapter from a book called "More Servlets and JSP" available online at Click on the link "Using Tomcat 4" which will guide you through setting up Tomcat properly - it's brilliant!!
Hope this helps.
I agree. Here's the link:
subject: Help - Can't get Servlets working!
It's not a secret anymore!