I've created a very simple Java 2 applet which runs fine from a file:// url,
but I'm having difficulty trying to deploy it on my
local MS IIS. I'm getting a 'class not found' error caused by a 'open HTTP
connection failed' error.
I've been tearing my hair out on this for a while now and would be very
grateful if someone could offer some pointers.
I've been trawling through the various technical forums and see that this
seems to be a common problem using Java 2 applets via the Java plugin with
IE6/IIS, though I've yet to see a definitive solution. I'm guessing this is
either an IIS or java plug-in configuration problem on my part but I can't
see what I have left to play with. I've successfully run JSP, servlets, ASP
and ASP.NET over the local IIS, and Java applets are the only thing I can't
get to work.
I'm using IE 6.0.2800 (XP Pro), IIS 5.1, Java Plug-in version 1.4.1_03,
which I believe is the latest. I have the plug in configured to use the
default plug-in JRE and the browser proxy settings (I'm not using a proxy),
though I've tried it both ways without success. The PC I'm running it on is
on a local network behind an ADSL router.
The applet runs fine when invoked from a file://.. URL (provided I remove
the codebase tag), but not when I try to run it through the local IIS as
http://localhost/Fetcher/Fetcher.html (or, for that matter, as
http://127.0.0.1/..., http://192.168.1.11/... etc etc).
The directory structure I'm using is as follows (I'm not using a package or
archive to simplify matters, though I appreciate you would probably do so in
a production scenario);
C:\Inetpub\wwwroot\Fetcher\Fetcher.html
C:\Inetpub\wwwroot\Fetcher\Fetcher.class
The HTML I'm using is;
<html>
<head>
<title>Fetcher Java Applet Demo</title>
<body>
<applet
CODEBASE="/Fetcher/"
CODE = "Fetcher.class"
WIDTH = 500
HEIGHT = 300
HSPACE = 0
VSPACE = 0
ALIGN = middle
ALT="Your browser understands the <APPLET> tag but isn't running the
applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
>
</applet>
</body>
</html>
The complete error message is as follows;
Java(TM) Plug-in: Version 1.4.1_03
Using JRE version 1.4.1_02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Steven Smith
Proxy Configuration: No proxy
[snip]
load: class Fetcher.class not found.
java.lang.ClassNotFoundException: Fetcher.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:252)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:42)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:140)
... 10 more
--
Steven Smith
--
Steven Smith