This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swing layout 1.0.4 from netbeans in a JApplet

 
Kristopher Matthews
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After talking it out with a friend, the problem is obvious: I'm depending on a jar that isn't signed. Duh.

 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic