This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: calling a Applet from a Servlet in Tomcat5