Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem running Spring in a java applet

 
Andrew Och
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anybody managed to get Spring to work within a java applet?

We using Spring 2.5 to initialise an applet. Our requirement is to provide a user interface both as a Swing standalone and web enabled version (applet) to run by Jetty.

Our Swing version works fine. However when we try to run the same code in an applet, we get the error seen below

The applet code is quite simple. Any help or advice warmly welcome.




[ July 03, 2008: Message edited by: Ulf Dittmer ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually Applets aren't very complex so a Spring context would rarely be of any real benefit. Assuming you're that rare case...

This thread suggests that you might be able to pull this off from a JFrame class inside your Applet.
 
Andrew Och
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Marc

Thank you for your response. Actually we are not using Spring RCP just pure Spring and embedding the applet in a jar combined with Jetty (embedded Jetty server).

My colleague Mr. Zhang Han found a solution to this problem/error displayed in previous post:



The above snippet was added to the Jetty's Context handler.

The problem was caused by Jetty redirecting to the root context when receiving an invalid URL (naturally it needs at least the root context in the url). Rather then giving an error 404 it would then return html. However the java.beans.Introspector which searches for BeanInfo before analysising the class (this search in the applet effectively inputs an invalid url). The java.bean.Introspector then no longer anaylsed the bean because BeanInfo had data (html). Then the class loader tries to load the BeanInfo class which is actually only html. Ugh. The above fixes this :-)

Although this then removed the problem. He hit another problem which was related to permission and this was solved by signing all the jars.

Andrew & Han
[ July 03, 2008: Message edited by: Andrew Och ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic