the servlet resides in the WEB-INF\classes\com\myapplet\LaunchApplet.class and the servlet resides in the WEB-INF\classes\com\myservlet\CalledServlet.class
the applet is working perfectly and it loads in the client side perfectly but when the applet is tried to load the explorer gives the following messages
---------------------------------------------------- load: class com.myapplet.LaunchApplet.class not found. java.lang.ClassNotFoundException: com.myapplet.LaunchApplet.class at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: open HTTP connection failed. at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method)
can any one suggest a remedy for this .. i need to load the applet in the client side ...
The browser is responsible for loading applet class files - it tries to get them from the server according to the codebase.
out.println("<applet codebase = \"..//\" code = \"com.myapplet.LaunchApplet.class\" name = \"TestApplet\"");
However, your applet tag indicates that the browser should try to get the classes relative to the same address as it got the HTML page. That is the servlet address - the server is NOT ALLOWED to directly serve anything under WEB-INF therefore the browser gets the error. You have two choices: 1. create a servlet to serve the applet classes from WEB-INF 2. move your applet classes under the main web application directory and use codebase to point to them (or specify a BASE location in the HTML page.)
Joined: Sep 25, 2003
thanks .. i tried the second option. i placed the applet and all the other things outside the web-inf folder
subject: calling a Applet from a Servlet in Tomcat5