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 Apache/Tomcat simple applet  problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache/Tomcat simple applet  problem" Watch "Apache/Tomcat simple applet  problem" New topic
Author

Apache/Tomcat simple applet problem

Idris Pathan
Greenhorn

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 ?)

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
Idris Pathan
Greenhorn

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
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
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
Sheriff

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
http://simple.souther.us . 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
 
wood burning stoves
 
subject: Apache/Tomcat simple applet problem
 
Similar Threads
simple question
Tomcat as a server & a container, how?
The requested resource (/review/HelloServlet) is not available
How to deploy my own webapplication
"HTTP Status 404" with Tomcat