• 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

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)
etc.

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.

tienshan
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tien,

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,

-daniel
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic