Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets on Tomcat

 
ralph michelsen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Javaranchers
I have made a simple applet which actually works fine on my ie6. But when I deploy all source to my Tomcat 4.1 I cannot get it to work.
I have places my applet source in a package called dk.chatrmi. My class file is called ChatImpl.class. I have placed the applet in the classes dir of my Tomcat. The following is my html file, which I have placed in the root of my Tomcat "examples". This is the content of the file:
<html>
<applet code="dk.chatrmi.ChatImpl.class" codebase="http://localhost:8080/examples/servlet" width=800 height=400></applet>
</html>
I have added the full path to the codebase attr. but still I cannot get it to work.
I have sdk 1.4 installed on my computer.
I get the following error in my Java console:
PLEASE HELP!!!
load: class dk.chatrmi.ChatImpl.class not found.
java.lang.ClassNotFoundException: dk.chatrmi.ChatImpl.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
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:566)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1775)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
at sun.applet.AppletPanel.run(AppletPanel.java:292)
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
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ralph,
try moving the applet code base out the servlet directory.
say put the applet's html and the package in examples directory instead.
i guess, the applet loader looks for classes in the applet's code base rather than the 'webserver classpath' settings u know.. and this 'servlet/' directory which is a 'virtual' directory so to say might be causing problems...
request to servlet/ only works for "servlets" ...well i wont elaborate on this much in the applet forum..
try moving the applet codebase out of the servlet directory and see if it works for u...
regards
maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic