• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat server not finding any web pages

 
Pojahn Moradi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Maven Tomcat Plugin to deploy and run a Tomcat server.

While accessing a servlet works fine, accessing web pages isn't. I am having trouble resolving this and need some help.

Here is the file structure of the project:
http://pastebin.com/2hHJ8u4y

Example of a servlet. Can be accessed with url localhost:9090/clicky/servlet

pom.xml

Web.xml, which I will probably be omitted:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pojahn Moradi wrote:While accessing a servlet works fine, accessing web pages isn't. I am having trouble resolving this and need some help.

Can you explain what issues you are having in more detail?
 
Pojahn Moradi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I get a 404 page generated by Tomcat, explaining that the page was not fond.
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What page?
What's the URL?
Where is the page file under (presumably) 'clicky'?
 
Pojahn Moradi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to open index.html. Looking at the project file structure, we can se there is one index.html directly under WebContent and one in WEB-INF. They are duplicated for testing purposes.

I use the following URL: localhost:9090/clicky/index.html
Tried to alter the url in may ways with no luck.

When the server started, tomcat prints that the server has been deployed to localhost:9090/clicky.
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you check the tomcat webapps/clicky directory to see what's actually been deployed?
 
Pojahn Moradi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you referring to target/tomcat/webapps? That one seems empty. There is target/tomcat/work/Tomcat/localhost/clicky, but that one is empty as well.
I can post the file structure of click.counter-1.0-SNAPSHOT.war when I get home from work.
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'll be the structure in the war (assuming that's what's actually being deployed).
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I spotted this in your configuration.
I don't think it means what you think it means.
Try removing the tomcatWebXml configuration line, and see if that resolves your problem.


Basically in addition to the web.xml file in your web application, there is a 'tomcat' web.xml file which declares standard servlet mappings.
Among those standard servlet mappings would be the handler for JSPs and static files (such as index.html).
Here you are overriding the standard one with your applications web.xml, which effectively disables the standard handling that Tomcat provides.
 
Pojahn Moradi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan Evans. That solved the issue. Suppose I should copy and modify the original web.xml if I want to expand it?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Your application should have a web.xml, of course, but you shouldn't modify Tomcat's web.xml.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic