Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Norm

Thread: Caused by: java.lang.SecurityException: class "Test$1" does not match trust level of

  1. #1
    catdude is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default Caused by: java.lang.SecurityException: class "Test$1" does not match trust level of

    I'm attempting to write a file chooser applet. I'm sort of aware of the security concerns and am trying to figure out how to work through it.

    The error I'm getting now when I try to access the applet through my web browser reads:
    Caused by: java.lang.SecurityException: class "Test$1" does not match trust level of other classes in the same package

    The Java source I'm working with can be found at java Expert Solutions: File Chooser Java applet code example

    My platform is:
    Ubuntu Linux, 32 bit, javac 1.6.0_22
    java version "1.6.0_22"
    OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
    OpenJDK Client VM (build 20.0-b11, mixed mode, sharing)

    Complete Java console output:
    FileApplet.init() : Applet loaded
    FileApplet.init() : Changing sandbox security
    java.lang.reflect.InvocationTargetException
    at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Un known Source)
    at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.SecurityException: class "Test$1" does not match trust level of other classes in the same package
    at com.sun.deploy.security.CPCallbackHandler$ChildEle ment.checkResource(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.checkResourc e(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(U nknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at Test.<init>(Test.java:18)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectio nPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception: java.lang.reflect.InvocationTargetException

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Caused by: java.lang.SecurityException: class "Test$1" does not match trust level

    The code at that site was not a java applet (it does not extend the Applet class).
    It looks like a desktop application (it extends JFrame).

    Is your problem an OS related thing?
    Fubarable likes this.

  3. #3
    catdude is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default Re: Caused by: java.lang.SecurityException: class "Test$1" does not match trust level

    Oops!

    No, I suspect it's a Java-newbie thing :) I'm a lot more comfortable programming in c, Perl, Python, or shell script than I am in Java. I didn't even notice that the sample code wasn't written as an applet.

    Back to the drawing board! And thanks for pointing that out to me.

Similar Threads

  1. Replies: 2
    Last Post: 04-27-2011, 04:58 AM
  2. Replies: 14
    Last Post: 04-08-2011, 06:01 PM
  3. Replies: 3
    Last Post: 03-21-2011, 01:48 PM
  4. Caused by: java.lang.SecurityException: Access denied
    By Dattatray in forum Advanced Java
    Replies: 0
    Last Post: 12-17-2010, 10:46 AM
  5. Replies: 1
    Last Post: 11-20-2009, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •