tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <david.sm...@cornell.edu>
Subject Re: HTTP status 404
Date Thu, 09 Dec 2010 18:04:23 GMT
Looks like you should be requesting /filename/filename.htm instead of
filename/ ... that is unless you've set a welcome file in the app's
web.xml file.

If that doesn't work, also take a look at the tomcat logs for the moment
in time you a. started tomcat, b. deployed your app (if different from
the time tomcat was started) and c. when you requested the file.

--David


On 12/9/2010 12:10 PM, Lava Saleem wrote:
> Hello everyone,
> Thanks for the replies I really appreciate your feedback
>
> I have the structure as the following
> webapps
> |
> filename
>     |- filename.htm
> *    |-*WEB-INF
>             |- web.xml
>     |-META-INF
>             |-context.xml
>
> after having this structure,I use the following command
>
> CATALINA_BASE/webapps/filename/ jar -cvf filename.war *.*
>
> then I deploy the file in the tomcat manager and I have the following error
>
> HTTP status 404
> description the requested resource (/filename/)is not available
>
> I assumed that I don't need the  java classes and lib in the WEB-INF  since
> I'm only having single html file with java script, Do you think I need any ?
> if so how do I know which files I need ?
>
>  I also extracted the filename.war just to see whats in there and I see only
> the filename.htm and the META-INF  there is no WEB-INF it is disappearing
>
> Thanks
> Lava
>
> On Wed, Dec 8, 2010 at 4:35 PM, André Warnier <aw@ice-sa.com> wrote:
>
>>  Lava Saleem wrote:
>>
>>> Hi everyone,
>>> I have  a single page html file with java script embadded in it, I have
>>> created a war file for it and deployed it successfully but when I click on
>>> the page I get the below error, the structure of my war file is the
>>> following
>>>
>>> webapp --> filename --> WEB-INF--> filename.htm  + web.xml + META-INF
>>> +  classes + lib
>>>
>>> I did not modify the web.xml since I don't need the servlets do I need to
>>> modify anything?
>>>
>>> HTTP status 404
>>> description the requested resource (/filename/)is not available
>>>
>>>
>> Hi.
>> Except the 404 error which your are getting, not much above makes any sense
>> at all.
>>
>> So it is better to forget all that, and start new.
>> You really have to learn to walk before you can run.
>>
>> First, consider the directory structure of a standard Tomcat installation :
>>
>> (CATALINA_HOME)
>> (=CATALINA_BASE)
>>      |
>>      |- bin (tomcat "programs" and scripts)
>>      |- conf (configuration files)
>>      |- lib (global library files)
>>      |- logs (logfiles)
>>      |- webapps (* web applications *)
>>            |- ROOT  (the special, top-level, default web application)
>>            |- app1 (a web application)
>>            |- app2 (another web application)
>>            |- ...
>>            |- lastapp (another web application)
>>
>> In the above, "(CATALINA_HOME)" represents the top directory of your Tomcat
>> installation, the one under which the rest of Tomcat is found.
>> For example, on your system it may be "C:\tomcat" or "C:\program
>> files\Apache Software Foundation\tomcat6.0" or "/usr/share/tomcat6" or
>> "/usr/local/tomcat6" or whatever.
>>
>> The "webapps" sub-directory is what is important for you now.  That is
>> where you will put "web applications", composed of static html pages (with
>> or without javascript in them), JSP pages (special html pages with embedded
>> Java code), java servlets (compiled java applications), etc..
>>
>> The ROOT web application is special.  It is the "default application".
>> When you use a URL like : http://yourserver.yourcompany.com/abc.html
>> Tomcat is going to look for "abc.html" under the webapps/ROOT directory.
>>
>> The other subdirectories under "webapps" are each one separate web
>> application.
>> To access for example the application named "app1", you will have to use a
>> URL starting with "http://yourserver.yourcompany.com/app1/...."
>> For example, if you place a html page named "xyz.html" in the subdirectory
>> (CATALINA_HOME)/webapps/app1, then the URL to call it up will be
>> http://yourserver.yourcompany.com/app1/xyz.html
>>
>> Under such a web application directory like ../webapps/app1, there is also
>> a structure.
>> It looks like this :
>>
>> (CATALINA_HOME)
>> (=CATALINA_BASE)
>>      |- webapps (* dir, top of all web applications *)
>>            |
>>            |- app1 (dir, contains the web application named "app1")
>>                - public files (html etc..)
>>                - WEB-INF (directory)
>>                     |- files (private)
>>                     |- web.xml (configuration file for the application)
>>                     |- classes (dir.)
>>                           |- compiled java classes, like servlets
>>                     |- lib (dir)
>>                           |- java libraries for this webapp
>>                - META-INF (dir.)
>>                     |- context.xml (more settings for the application)
>>
>> Basically everything under "app1" is optional.  Tomcat will supply a
>> default if needed.
>> Of course, you will want at least one file under there, to make the execise
>> meaningful.
>>
>> What is in the sub-directories WEB-INF and META-INF, can never be obtained
>> directly by a browser. Tomcat will not allow it.
>> So if you enter the following URL in the browser :
>> http://yourserver.yourcompany.com/app1/WEB-INF/something
>> Tomcat will respond with an error, even if "something" exists.
>>
>>
>> But to start, I suggest that you just
>> - stop tomcat
>> - create a new sub-directory under ../webapps/, for example "myapp".
>> - under that subdirectory, place a file called "myfile.html"
>> - verify that the ownership and permissions of these files are such that
>> the Tomcat user can read them
>> - start Tomcat
>> - in the browser, enter the URL :
>> http://yourserver.yourcompany.com/myapp/myfile.html
>> and enjoy.
>>
>> Now play around with the above :
>> - create another page "mypage2.html", place it alongside "myfile.html",
>> start Tomcat and call up the new page in the browser.
>> - then stop Tomcat again, and create another subdirectory under "webapps",
>> put something there, start Tomcat and call it up with the browser.
>> - then stop Tomcat again, create a sub-directory "WEB-INF" under one of
>> your webapps, put something in it, start Tomcat and try to call up that
>> file.
>>
>> When you understand exactly how that works, then go read this page (again)
>> :
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/appdev/deployment.html
>>
>> And then you should come back for more questions about how to make .war
>> files and deploy them properly.
>> (tip : a .war file is just a zip file with the same content as the "app1"
>> subdirectory above.  It has to be named "app1.war", and you have to copy it
>> under /webapps/ for Tomcat to understand what you want).
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message