Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web Application Folder

 
Raja Vadlamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Servlets, while everything is working fine when I placed servlets in ROOT folder in webapps.
But when I create my own folder in webapps, and place all files in that, it is not working and giving the following error message:
Apache Tomcat/4.0.1 - HTTP Status 404 - /Raja/hai.html
--------------------------------------------------------------------------------
type Status report
message /Raja/hai.html
description The requested resource (/Raja/hai.html) is not available.
--------------------------------------------------------------------------------
Thanks in advance.
 
Kelvin Hung
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did u configure web.xml to map ur servlet classes to urls?
 
Raja Vadlamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did mapping something like
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
but before than that, I am just trying to make a normal .html file work which has nothing to do with web.xml, like
http://localhost:8080/Raja/hai.html
Even this is giving an error.
Thank you.
 
Kelvin Hung
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did u put ur folder under ROOT or webapps? ROOT is the "root" of ur server, any folder above it is not accessible. So Root/Raja/ is ok, but webapps/Reja/ is not ok.
 
Raja Vadlamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the folder is webapps/Raja. I am not sure why this is not ok. The other folders like examples, manager, tomcat-docs, webdav work fine even if they are not under ROOT and are just under webapps?
 
Kelvin Hung
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In C:\Tomcat\conf\server.xml. It has a element called
<Context path="" docBase="ROOT" debug="0"/>
So if you want to run the example, you need to change that to example.
So in your case, you can try to change the docBase to Raja.
 
Raja Vadlamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<!-- Tomcat Root Context -->
<!--
<Context path="" docBase="ROOT" debug="0"/>
-->
The above lines are from conf/server.xml , they are commented. I removed comments and then put Raja in place of ROOT, even then it didnt worked and now even ROOT didnt started working.
So I commented them back and added one more Context path with docbase="Raja", even now it is not working.
 
Kelvin Hung
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Raja Vadlamudi:
<!-- Tomcat Root Context -->
<!--
<Context path="" docBase="ROOT" debug="0"/>
-->
The above lines are from conf/server.xml , they are commented. I removed comments and then put Raja in place of ROOT, even then it didnt worked and now even ROOT didnt started working.
So I commented them back and added one more Context path with docbase="Raja", even now it is not working.

Does your url include /Raja?
My guess is when docbase is Raja, you don't need /Raja in your path. Try
http://localhost:8080/hai.html
 
Raja Vadlamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
neither of them worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic