File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Problem running Spring in a java applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Problem running Spring in a java applet" Watch "Problem running Spring in a java applet" New topic
Author

Problem running Spring in a java applet

Andrew Och
Ranch Hand

Joined: Mar 19, 2004
Posts: 32
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

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Andrew Och
Ranch Hand

Joined: Mar 19, 2004
Posts: 32
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem running Spring in a java applet