File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Running simple HTML script on TOMCAT returns 404 error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Running simple HTML script on TOMCAT returns 404 error" Watch "Running simple HTML script on TOMCAT returns 404 error" New topic
Author

Running simple HTML script on TOMCAT returns 404 error

ghassan hallo
Greenhorn

Joined: May 20, 2014
Posts: 4
Greetings,

I have been facing this problem for quite a while, at the beginning everything was ok until I decided to add another html page to my project in WEB-CONTENT and now it wont even run the first html file/page that I already was successful to load at the beginning, all configuration steps were done as mentioned here :[reference] (http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html)
what I tried already:

-Copied root directory
- Made sure Apache Tomcat 7.0 was chosen to execute as file was being created
- switched locations in the properties menu when right clicking on the server in console area
- Allowed Eclipse to take over control of the installation of Tomcat
- checked web.xml and my html script is listed as a welcome page...
**LOG**:

May 18, 2014 1:22:35 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Java\jdk1.6.0_25\bin;C:\Program Files (x86)\Java\jre6\bin;C:\Program Files (x86)\Android\android-sdk;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\SVN\bin;D:\matlab2011\runtime\win64;D:\matlab2011\bin;C:\Program Files (x86)\Google\google_appengine\;C:\Program Files (x86)\OpenVPN\bin;.
May 18, 2014 1:22:36 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Uebung1' did not find a matching property.
May 18, 2014 1:22:36 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 18, 2014 1:22:36 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 18, 2014 1:22:36 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1345 ms
May 18, 2014 1:22:36 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 18, 2014 1:22:36 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
May 18, 2014 1:22:37 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\user\Desktop\TOMCAT\apache-tomcat-7.0.53\webapps\docs
May 18, 2014 1:22:37 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\user\Desktop\TOMCAT\apache-tomcat-7.0.53\webapps\examples
May 18, 2014 1:22:39 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
May 18, 2014 1:22:39 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
May 18, 2014 1:22:39 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@208c4895')
May 18, 2014 1:22:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\user\Desktop\TOMCAT\apache-tomcat-7.0.53\webapps\host-manager
May 18, 2014 1:22:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\user\Desktop\TOMCAT\apache-tomcat-7.0.53\webapps\manager
May 18, 2014 1:22:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\user\Desktop\TOMCAT\apache-tomcat-7.0.53\webapps\ROOT
May 18, 2014 1:22:40 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 18, 2014 1:22:40 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 18, 2014 1:22:40 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3574 ms


**END OF LOG**

The index.html file includes a header and a couple of bold letters its very basic
that it runs in the preview pane when selecting a file in windows explorer.

I checked my directories several times as well as uninstalling and re-installing.

Any help appreciated.

ghassan hallo
Greenhorn

Joined: May 20, 2014
Posts: 4
Another side note:

tomcat is responding and I am getting the usual pages and even the examples pages... but it all breaks down when it comes to running other scripts.

Regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
Welcome to JavaRanch.

What does "it wont run" and "it all breaks down" mean? TellTheDetails. What are you doing, what happens as a result, and how is that different from what you were expecting?

The log file looks normal. My usual advice is: don't run Tomcat inside of an IDE. It behaves differently in ways that can be hard to recognize and fix, particularly by people who do not sit in front of your computer.


Ping & DNS - my free Android networking tools app
ghassan hallo
Greenhorn

Joined: May 20, 2014
Posts: 4
Ulf Dittmer wrote:Welcome to JavaRanch.

What does "it wont run" and "it all breaks down" mean? TellTheDetails. What are you doing, what happens as a result, and how is that different from what you were expecting?

The log file looks normal. My usual advice is: don't run Tomcat inside of an IDE. It behaves differently in ways that can be hard to recognize and fix, particularly by people who do not sit in front of your computer.


Ok so basically I am trying to display an HTML page in the browser after it runs on tomcat, i have created a dynamic web project and created a new html file named "index.html" inside WEB-INF, I enter
localhost:8080 and I see the Tomcat home screen, and tried also localhost:8080/examples and I was able to the examples page which is on the tomcat server which means its running. Once I tried to
run the HTML page I created, using "run as" and run on tomcat server, on both the eclipse built-in browser and Firefox I kept getting a 404 status error message "requested resource not available".

I hope this made it clearer.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
i have created a dynamic web project and created a new html file named "index.html" inside WEB-INF

Nothing that is inside of WEB-INF will ever be served to the client. Check the "examples" web app to see where its index.html file is.
ghassan hallo
Greenhorn

Joined: May 20, 2014
Posts: 4
Ulf Dittmer wrote:
i have created a dynamic web project and created a new html file named "index.html" inside WEB-INF

Nothing that is inside of WEB-INF will ever be served to the client. Check the "examples" web app to see where its index.html file is.


But I have visited so many websites and tutorials and html files are always in the WEB-INF , I dont have any servlets or even jsp files all i want is just a normal
html script to be processed and displayed. The webapp examples are all located in the tomcat directory, while the ones I create will be places somewhere else and
even in several places, like the workspace and the tomcat directory.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
But I have visited so many websites and tutorials and html files are always in the WEB-INF

I very much doubt that, precisely for the reason that the servlet container will never serve anything in WEB-INF to a browser. So a URL like http://localhost:8080/myApp/WEB-INF/index.html simply will not work. If you want http://localhost:8080/myApp/index.html to work, then index.html must be outside of WEB-INF. (That said, it is possible to get the content of files that are inside of WEB-INF to be served to the browser via an include or a forward - but never directly. And since you don't have any servlets, it's not an option for you. And it would anyway be unusual for static content like HTML; it's very common for JSPs, though.)

like the workspace and the tomcat directory.

A normal Tomcat installation does not have those, so I'm not sure how those might work. That's why I advise to use a standalone Tomcat outside of any IDE.
 
wood burning stoves
 
subject: Running simple HTML script on TOMCAT returns 404 error