• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Help - Can't get Servlets working!

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
public/
sys/
Xdbconfig.xml
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 :-
Tomcat\webapps\chapter01\WEBINF\classes\HelloWorldServlet.class
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 java.net.Connection error is shown on my screen with a large stack trace that goes through from top to bottom as follows:-
java.net.PlainSocketImp,
java.net.Socket,
org.apache.catalina.startup,
org.apache.catalina.execute
org.apache.catalina.process
sun.reflect.NativeMethodAccessorImpl, sun.reflect.DelegatingMethodAccessorImp.invoke()
java.lang.reflect.Method.invoke()
org.apache.catalina.startup.main()
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.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
Con
 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
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
con,
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: https://coderanch.com/t/81585/Tomcat/tomcat-startup
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 www.moreservlets.com. Click on the link "Using Tomcat 4" which will guide you through setting up Tomcat properly - it's brilliant!!
Hope this helps.
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic