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

Tomcat server not finding any web pages

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 67746
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I get a 404 page generated by Tomcat, explaining that the page was not fond.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It'll be the structure in the war (assuming that's what's actually being deployed).
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. Your application should have a web.xml, of course, but you shouldn't modify Tomcat's web.xml.
 
reply
    Bookmark Topic Watch Topic
  • New Topic