views:

48

answers:

1

I'm in the process of porting a prototype application developed under Tomcat to JBoss for production. Part of our app is an applet for uploading data onto the web server. Here's the code for the applet:

 <applet id="UploaderApplet" name="UploaderApplet" 
   code="com.initech.uploader.AppletFrontend.class"
   archive="jar/Initech.Uploader.jar" mayscript
         width="1px" height="1px">
   <param name="separate_jvm" value="true" />
         <param name="java_arguments" value="-Xmx300m"/>
 </applet>

This applet works fine when served under Tomcat, but when the same application is hosted on a JBoss server, the Java Console shows ClassNotFoundExceptions:

MRJ Plugin for Mac OS X v1.0.1
[starting up Java Applet Security @ Thu May 13 09:48:07 EDT 2010]
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@165b7e, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@e45b5e
basic: Loading applet…
basic: Initializing applet…
network: Connecting http://localhost:8080/myapp/jar/Initech.Uploader.jar with proxy=DIRECT
network: Connecting socket://localhost:8080 with proxy=DIRECT
network: Connecting http://localhost:8080/myapp/jar/Initech.Uploader.jar with proxy=DIRECT
network: Connecting socket://localhost:8080 with proxy=DIRECT
network: Connecting http://localhost:8080/myapp/com/initech/uploader/AppletFrontend.class with proxy=DIRECT
network: Connecting socket://localhost:8080 with proxy=DIRECT
network: Connecting http://localhost:8080/myapp/com/initech/uploader/AppletFrontend/class.class with proxy=DIRECT
network: Connecting socket://localhost:8080 with proxy=DIRECT
load: class com.initech.uploader.AppletFrontend.class not found.
java.lang.ClassNotFoundException: com.initech.uploader.AppletFrontend.class
 at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
 at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
 at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:662)
 at sun.applet.AppletPanel.createApplet(AppletPanel.java:785)
 at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2372)
 at jep.AppletFramePanel.createApplet(Unknown Source)
 at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
 at sun.applet.AppletPanel.run(AppletPanel.java:368)
 at jep.AppletFramePanel.run(Unknown Source)
 at java.lang.Thread.run(Thread.java:637)
basic: Exception: java.lang.ClassNotFoundException: com.initech.uploader.AppletFrontend.class

I'm able to download the jar from the links listed in the log dump. For what it's worth, my development environment is a Snow Leopard Mac running Firefox 3.6.

A: 

The fact that this works in Tomcat and not in JBoss makes me think that the two servers are interpreting differently what the browser requests for the applet (this is just a hunch though).

The exception says

java.lang.ClassNotFoundException: com.initech.uploader.AppletFrontend.class

That's with a .class at the end. Not sure, but shouldn't that be :

java.lang.ClassNotFoundException: com.initech.uploader.AppletFrontend

Try without the .class, like:

code="com.initech.uploader.AppletFrontend"

You could also specify a codebase attribute and remove the path from archive; see if that changes anything.

dpb
All good suggestions. The .class in the code attribute is actually required per Sun's original specification. Changing the codebase attribute had no effect.
jordan002