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

swing layout 1.0.4 from netbeans in a JApplet

Kristopher Matthews
Greenhorn

Joined: Sep 29, 2010
Posts: 6
I used Netbeans to create a JApplet which I want to embed in a web page (specifically on glassfish). By default netbeans uses org.jdesktop.layout.GroupLayout. When I attempt to embed this in my web app, I end up with the below stack trace (on OSX). The applet itself is utterly uninteresting - it's the default empty applet that Netbeans generates.

I've googled and googled to no avail. Sorry, I realize this is all newbish and I'm probably missing something obvious.


Here is the script to deply


Stack trace
Kristopher Matthews
Greenhorn

Joined: Sep 29, 2010
Posts: 6
After talking it out with a friend, the problem is obvious: I'm depending on a jar that isn't signed. Duh.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

From the stack trace, it looks like applet security doesn't let unsigned applets use reflection. And the layout manager you're using does use reflection.

I thought surely this would have already been reported as a bug to the Swing Layout project, and sure enough it was, four years ago:

https://swing-layout.dev.java.net/issues/show_bug.cgi?id=40

It says "Fixed" so I assume you just have to download a version in which the fix is present.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Kristopher Matthews wrote:After talking it out with a friend, the problem is obvious: I'm depending on a jar that isn't signed.


But you shouldn't have to sign a jar just to work around a faulty implementation of one of its classes.
Kristopher Matthews
Greenhorn

Joined: Sep 29, 2010
Posts: 6
I agree. In this particular case, I'm just going to not use this jar - I was only using it because that's what netbeans generated by default.

Interesting that the bug is marked as fixed. I am using 1.0.4 (which is what came with Netbeans 6.9.1). Looking at the stack trace, the issue starts at LayoutStyle.getSharedInstance(),



It looks like this will only happen if the layout style is "Aqua", aka on mac os x. If they were to catch "AccessControlException" around line 15 here, that would .. at least help or something.
 
Consider Paul's rocket mass heater.
 
subject: swing layout 1.0.4 from netbeans in a JApplet