• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

404 error on browser while i try to get tomcat homepage

 
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am reading the HEAD FIRST SERVLET , and following their instruction
After installing apache tomcat, their is one instruction given :

Set environment variable for JAVA_HOME and TOMCAT_HOME, in whatever way you normally set them for your system.



book ask me for TOMCAT_HOME but here is something they ask for CATALINA__HOME.

So I saved these two system variables :
CATALINA__HOME : C:\Program Files\Apache Software Foundation\Tomcat 8.0
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_91


I started the server by clicking on C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\startup.bat and tomcat promt opened up and the last line to that is Server startup in 3456 ms ( i hope server is started )
Then I opened my chrome browser and type the url : http://localhost:8080/
But that gave me site can't be reached error


Here are some snapshots
please help me out. Thanks
browser-error.png
[Thumbnail for browser-error.png]
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I recall correctly, remove the env variable for TOMCAT_HOME and just set JAVA_HOME. The startup script takes care of the rest.
 
Puspender Tanwar
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello Bear,
I am not having any TOMCAT_HOME env variable. But have CATALINA__HOME, now if I delete this, still I am getting the same error
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my problem I would execute startup.bat from a command prompt window so I could see exactly what is happening.
There may be some error message you are missing.

Bill
 
Puspender Tanwar
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello William, I tried it in command promt and what i got is :


C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin>startup.bat
Using CATALINA_BASE: "C:\Program Files\Apache Software Foundation\Tomcat 8.0"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Tomcat 8.0"
Using CATALINA_TMPDIR: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\t
emp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_91"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\b
in\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\tomc
at-juli.jar"
C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin>


could you please tell me what's wrong ?

Do I need to insert %JAVA_HOME%/bin in the path variable ?
 
Puspender Tanwar
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I use eclipse and start tomcat, the tomcat is working fine, but here also it is not showing the homepage saying 404 error

I guess, tomcat is unable to start when i start it manually by startup.dat . That's why it is saying "localhost refused to conect" when i start tomcat manually but giving 404 error when i start it from eclipse

 
Saloon Keeper
Posts: 28713
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear is correct. All you really need set in your environment is JAVA_HOME. The Tomcat scripts will deduce the other environment values by default.

A 404 error means that either you have some other service running at the target IP address and port or that the URL that you're sending to Tomcat doesn't match for any deployed web application. Tomcat will successfully start up if another application (even another Tomcat) is already using the port, but it will log an error and not listen on that port, since only one application can own a given TCP/IP port at a time (this is a limitation of the TCP/IP architecture on all current OS's).

A standalone Tomcat would most commonly fail to resolve because either A) the app isn't properly deployed in it or B) your IDE is already running a Tomcat in which the app isn't deployed and it owns the port, so your request is going to the wrong Tomcat.
 
Puspender Tanwar
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what to do now ??

http://localhost:8080/servlet1_project/frontPage.html This url is working fine, but when i try to access the tomcat homepage using http://localhost:8080 , it log a 404 error. I guess th ports are not used by any other application, because my servlet1_project is running fine .

These problems are occurring when I am using Eclipse IDE, without IDE the connection is refused by the localhost
 
reply
    Bookmark Topic Watch Topic
  • New Topic