• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling applet from a JSP, classNotFound exception  RSS feed

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!
I am using servlet, struts and EJB to retrieve data from a database. JBoss provides the EJB container.
After a request is sent, a jsp is returned and I want to put some code inside the jsp to call an applet,
along with some other parameters for the applet.

The applet classes are in com/tienshan/applet/nbsa11 folder. This whole thing is in src folder.

I wrote the following code inside the jsp.

<applet code="com.tienshan.applet.nbsa11.NBSA110Main.class" archive="A11Test.jar" width=1000 height=900>

When I start the JBoss server and send a request, I can see that the jsp in which the above code is written
is called but immediately after that, I get the following error.

java.lang.ClassNotFoundException: com.tienshan.applet.nbsa11.NBSA110Main.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)

When I check the contents of the A11Test.jar, I have com/tienshan/applet/nbsa11 folders and inside the nbsa11 folder, the NBSA110Main class.
A11Test jar is in the same folder as the jsp which calls NBSA110Main applet.

I tried with a war file (test.war) from JBoss's deploy folder and put this one instead of the A11test.jar,
with archive="test.war.

No change, even though the test.war also has the same folder structure: com/tienshan..

What am I missing? I copied the NBSA110Main class. directly in the same folder and (without the archieve parameter), tried to call the applet. Still no change.

Could someone please give me some hint?

Thank you.

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Firstly, the HTML tag <APPLET...> is deprecated in favor of the <OBJECT...> tag; check out this API note for more information.

Secondly, applet code has nothing to do with your servlet / jsp container and conversely, your servlet classpath doesn't provide the client (browser) with the applet. Specifically, the applet should be stored in a place that can be referenced via a URI and you should employ the attributes "codebase" and "archive" to point to the proper location. My guess is (and this is only a guess) that you should store the applet in the same location as the JSP file.

Good luck,

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!