File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Apache/Tomcat simple applet  problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache/Tomcat simple applet  problem" Watch "Apache/Tomcat simple applet  problem" New topic

Apache/Tomcat simple applet problem

Idris Pathan

Joined: Feb 16, 2007
Posts: 4
Hi, I have installed Apache/Tomcat
Apache 2.2.4(Win32)
Tomcat Version - Apache Tomcat/6.0.9
JVM Version 1.5.0_10-b03
JVM Vendor Sun Microsystems Inc.
OS Name Windows XP

I am trying to run a simple applet - Hello.html, I can run this by just clicking on the html file and this is then displayed in my browser. There are no classes associated with this. The Hello.html file is located in tomcat\webapps\Hello.html.

When entering http://localserver:8080/Hello.html
I see the following error on the web browser

HTTP Status 404 - /Hello.html
type Status report
message /Hello.html
description The requested resource (/Hello.html) is not available.
Apache Tomcat/6.0.9

Can I run an applet that does not call a servlet in my Apache/Tomcat server ?

I am trying this out to make sure
1.)I can call a simple applet,
My next step would be to
2)call an applet that has classes
and then to
3)call an applet that uses servlets that have database access.

Any ideas as to why this is not working ? or any help would be greatly appreciated.

For the simple Servlet I have not changed anything in my server.xml file and I have not created a web.xml file either (am I right in thinking the web.xml file is only required for servlets ?)

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
First of all, there is no such thing as an "applet without classes". An applet is nothing but its classes.

As to the problem at hand, Tomcats root directory is not "webapps", but "webapps/ROOT". If you put the HTML file in there it should be found.
Idris Pathan

Joined: Feb 16, 2007
Posts: 4
Hi Ulf, thanks for the reply, yes adding the HTML in to the webapps/ROOT directory fixed the problem.

Thanks for that.

I am now trying to set up a applet that calls servlets to work.

I am not quite sure about what needs to be included in my web.xml.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The Applet FAQ has a few links regarding how an applet might communicate with a servlet.

For servlet question, please start a new thread in the Servlets forum.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
I would also put the Hello.html in de directory webapps, because by normal deployment the applications they are stored here.

Your tip puting them in the webapps/root is working.

I will remember this.

Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Individual files do not go in the webapps directory; web applications do.

A web application can be either a packaged war file or a directory structure that conforms to the servlet spec's definition (the root folder must contain a directory named "WEB-INF".

The ROOT folder under webapps is one web application.

If some more samples would help, I have several pre-packaged web apps at . Download any of those war files to your webapps directory and Tomcat will unpack and deploy them automatically.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Apache/Tomcat simple applet problem
It's not a secret anymore!