File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Web Application Folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Web Application Folder" Watch "Web Application Folder" New topic
Author

Web Application Folder

Raja Vadlamudi
Greenhorn

Joined: Feb 05, 2004
Posts: 7
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

Joined: Jan 15, 2004
Posts: 29
did u configure web.xml to map ur servlet classes to urls?
Raja Vadlamudi
Greenhorn

Joined: Feb 05, 2004
Posts: 7
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

Joined: Jan 15, 2004
Posts: 29
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

Joined: Feb 05, 2004
Posts: 7
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

Joined: Jan 15, 2004
Posts: 29
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

Joined: Feb 05, 2004
Posts: 7
<!-- 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

Joined: Jan 15, 2004
Posts: 29
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

Joined: Feb 05, 2004
Posts: 7
neither of them worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Application Folder