• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem loading applet from servlet - load: xxx.class not found

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm trying to load an applet from servlet, I'm using IE5, the java plug is ready in my local pc and server. The following is the code in servlet:
out.println("<OBJECT classid=clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA WIDTH =300 HEIGHT =300 codebase=http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0>");
out.println("<PARAM NAME = CODE VALUE = HelloWorld.class >");
out.println("<PARAM NAME = ARCHIVE VALUE=HelloWorld.jar>");
out.println("<PARAM NAME = CODEBASE VALUE =/myfolder/applet/ >");
out.println("<PARAM NAME=type VALUE=application/x-java-applet;jpi-version=1.3.1>");
out.println("<PARAM NAME=scriptable VALUE=false>");
out.println("</OBJECT>");
I tried the same thing (without the "out.println") in html or jsp, both of them works fine, the applet is loaded successfully. When I tried to load the servlet, I received an exception - ClassNotFoundException. I'ev stucked in the problem for quite some time. Can you help me to solve this problem?
Thanks
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
ClassNotFound is a classpath problem. Check ur classpath for the classes u r using.
Regards,
sim sim.
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thanks for the response.
I set the classpath to the 3 folders where i store the servlet, jsp and applet. But I still receive the same result.
I try to jar the class and save it in the same folder as the applet. I can load the applet successfully in
<html>
<head><title>SwingTest</title>
</head>
<body>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="475" height="350"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-
1_2_2-win.cab#Version=1,2,2,0">
<PARAM name="code" value="SwingTest.class">
<PARAM name="archive" value="SwingTest.jar">
</OBJECT>
</body>
</html>
and I received the same exception when i did it in the servlet..
Is there any possible solution to solve this problem?? Really appreciate that.
Thanks and regards
 
sim sim
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this line
("<OBJECT classid=clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA WIDTH =300 HEIGHT =300 codebase=http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0>");
are u sure that there are ',' delimiters for version. Check it out.
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did a search in google, found that there are people using the same thing as i used and yet there is one dialog box popped up asking whether to download the plug in. I think that should be no problem.
Usually where will be the applet stored in the server? Will it be the same place with the servlet or jsp pages?? What about the jar file?
I created a folder called applet, which stores all the applet and jar file and set the classpath to the applet folder. but I still can't get the applet loaded in the browser, can you tell me what is the correct way?
Thanks and Regards
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi conio,
try to put double -quotes in the servlet code that is writing Applet code to the browser. that might be the problem. i am not sure though.
i know its really cumbersome job to put escape chars and put "" everywhere but that might work...
else i don see any problem with your servlet code...
try it..
regards
maulin.
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thanks for the reply again...
I've put the double quote in the servlet, but the applet is still cannot be loaded.
The following is the message I can see in the java console:
java.io.FileNotFoundException: http://192.168.1.2/myfolder/web/SwingTest.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.checkCookieHeader(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.net.protocol.http.HttpUtils.followRedirects(Unknown Source)
at sun.plugin.cache.CachedJarLoader.download(Unknown Source)
at sun.plugin.cache.CachedJarLoader.load(Unknown Source)
at sun.plugin.cache.JarCache.get(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at sun.plugin.security.PluginClassLoader.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)
load: class SwingTest.class not found.
java.lang.ClassNotFoundException: SwingTest.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at sun.plugin.security.PluginClassLoader.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)

my servlet is stored in the myfolder\servlets. Both the jar and class files are storedi n myfolder\web. In the WAS, I set the classpath as c:\websphere\appserver\hosts\default_host\myfolder\web\ and c:\websphere\appserver\hosts\default_host\myfolder\servlets\
I'm sorry that my question sounds stupid, but is that the right path that i should set?
Thanks again....
Regards.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi conio,
no question sounds stupid. dont worry. recently i ran into a problem. my javac was not able to find java.io.* in import can u believe that? it worked when i moved files to another port's directory!
back to ur problem. i have never worked with websphere but one more option u can try. put your jar file in the classpath itself in addition to the path u r having. then see if that works.
regards
maulin.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic