• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Tomcat: Problems with localhost and directories

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

So, I finally got it to the point where if I put http://localhost:8080/ into navigation on my web browsers, I go to the Tomcat site. The one that says


If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!


But!! When I try to do something else, like http://localhost:8080/SomeDirectory/hello.html it gives me the error message
"HTTP Status 404 - /SomeDirectory/hello.html

--------------------------------------------------------------------------------

type Status report

message /SomeDirectory/hello.html

description The requested resource (/SomeDirectory/hello.html) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.35"


Yet at the same time, if I enter into the navigation bar C:\Java\tomcat\webapps\ROOT\SomeDirectory\hello.html, THAT shows up correctly!

Plus, once I'm at the main Tomcat page, nothing that isn't already online works. For instance, if I go to the left menu and click anything there besides "Tomcat Online"-- for example, Administration->Status, I get an error message:

"HTTP Status 404 - /manager/status

type Status report

message /manager/status

description The requested resource (/manager/status) is not available.
Apache Tomcat/6.0.35"

What's going on? The directory for that CAN'T be wrong, can it?

Please help!
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mel Anisky wrote:But!! When I try to do something else, like http://localhost:8080/SomeDirectory/hello.html it gives me the error message
"HTTP Status 404 - /SomeDirectory/hello.html


That means that the web app mapped to the context path SomeDirectory isn't set up correctly and isn't loading.

Yet at the same time, if I enter into the navigation bar C:\Java\tomcat\webapps\ROOT\SomeDirectory\hello.html, THAT shows up correctly!


Well, of course. The browser is simply loading the file from the file system. Tomcat isn't involved at all when you do that.

The problem is that you've mixed your web app in with the ROOT web app. The SomeDirectory folder should be in webapps, not webapps/ROOT.

Fix your mistakes and we can take the rest from there.
 
Mel Anisky
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I've done that. The html file is now at

C:\Java\tomcat\webapps\SomeDirectory

and

http://localhost:8080/SomeDirectory/Hello.html

still yields "HTTP Status 404 - /SomeDirectory/hello.html

type Status report

message /SomeDirectory/hello.html"


 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the tomcat admin page to ensure the application has been loaded ? Copying directories into tomcat will not deploy applications automatically. You need a .war file that is deployed under the folder 'webapps' or an equivalent folder.
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the context root folder exists in webapps, Tomcat will deploy the web app if (and only if) the web app is correctly formed. A war file is not necessary.

We'll obviously need more details regarding how you deployed your web app.

But first, check the logs to see if there are any problems reported, and check the Tomcat Manager application to see if it even knows the web app exists.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A war file is not necessary.



True. Bear is referring to exploded deployments.

To clarify what I said earlier, tomcat cannot be treated like the root folder that say apache would scan to serve HTML content. Unless the folder is structured to be recognized as a web-deployment, tomcat will not recognize it.
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic