class not found exception and IO exception while run applet on web

This is my jsp file body tag.

<body>
   <jsp:plugin type="applet" code="SApplet.class" 
        codebase="C:\Program Files\apache-tomcat-6.0.18\webapps\testweb\WEB-INF\classes" 
        width="400" 
        height="300" jreversion="1.6"></jsp:plugin>


  </body>

I want to run my applet on web application, but i got following error that will fetch on one small window.I can't get any error on console.

Java Plug-in 1.6.0_20
Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Sandy
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
load: class SApplet.class not found.
java.lang.ClassNotFoundException: SApplet.class
 at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/testweb/SApplet/class.class
 at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
 at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
 at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 ... 7 more
Exception: java.lang.ClassNotFoundException: SApplet.class
load: class SApplet.class not found.
java.lang.ClassNotFoundException: SApplet.class
 at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
 at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/testweb/SApplet/class.class
 at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
 at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
 at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 ... 7 more
Exception: java.lang.ClassNotFoundException: SApplet.class

Answers


Your code base is written wrong. It should be a relative web path.

In your case it should be something like testweb/applet-classes. But put all applet classes there, not under WEB-INF. WEB-INF is a place where you should store classes that run on server side. This folder may be not accessible from web. The applet classes are downloaded by JVM that is running into browser, so WEB-INF may be not visible for it.

Better way is even pack your applet classes into jar file and put it even under root of your application. In this case your code base will look like codebase='myapplet.jar'


Need Your Help

How can I generate a git diff of what's changed since the last time I pulled?

git diff rake pull

I'd like to script, preferably in rake, the following actions into a single command:

Stop duplicates when looking for contains() in XSLT

xml xslt sorting duplicates selection

Okay, I have reached a complete mental block on trying to get this to work and was wondering if anyone else might be able to get their head around it. I have the following structure to HTML.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.