Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

calling applet from a JSP, classNotFound exception

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,

Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic