3 Replies Latest reply on Feb 20, 2004 8:51 PM by John Hethcox

    AccessControlException on create method

    xlahaut Newbie

      Hi !

      I've got a little problem with my signed applet on client side. I try to access a session bean, the lookup works well, but there an Exception when I call the create method on the home interface.
      Here is the code :

      Properties prop = new Properties();
      prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      prop.put(Context.PROVIDER_URL,"localhost");

      Context ctx = new InitialContext(prop);
      Object objref = ctx.lookup("ejb/session/LetterSession");
      LetterSessionHome letterSessionHome = (LetterSessionHome)javax.rmi.PortableRemoteObject.narrow(objref, LetterSessionHome.class);
      letterSession = letterSessionHome.create();

      Here is the Exception :

      java.security.AccessControlException: access denied (java.lang.RuntimePermission org.jboss.security.SecurityAssociation.getPrincipalInfo)

      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)

      at java.security.AccessController.checkPermission(AccessController.java:401)

      at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)

      at org.jboss.security.SecurityAssociation.getPrincipal(SecurityAssociation.java:109)

      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:72)

      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)

      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

      at $Proxy0.create(Unknown Source)

      at applet.StoreLetterHandler.(StoreLetterHandler.java:25)

      at applet.FolderWatcher.(FolderWatcher.java:36)

      at applet.writeFile.init(writeFile.java:109)

      at sun.applet.AppletPanel.run(AppletPanel.java:341)

      at java.lang.Thread.run(Thread.java:536)

      Could someone help me ??? Thanks

        • 1. Re: AccessControlException on create method
          Michal Palicka Newbie

          Hi!
          I'm facing exactly the same problem.
          I'm not sure whether it is related to security settings for the server (JBoss) or for the client (signed applet).

          My applet only works if I grant "java.security.AllPermission"
          to it using the Java Plugin Control Panel (Java Runtime Parameters). But a signed applet should work without any policy settings.

          Thanks in advance for help.

          • 2. Re: AccessControlException on create method
            Sverker Abrahamsson Novice

            A bit late but when facing the same problem and searching the web for solutions I found the same question over and over again but never any answers.

            This should probably be in a FAQ and the issue is the same for both applets and webstart applications.

            The catch is that each jar file that your applet or webstart application is using have to be signed, even e.g. the jboss client jarfiles. To do that, I added the following target to my build.xml:

            <!-- ================================================ -->
            <!-- Sign jar files that are used by applet -->
            <!-- ================================================ -->




















            and then I include it in my .war by adding the following line to the war task:



            It worked like a charm, no need to mess with any policy files no more.

            • 3. Re: AccessControlException on create method
              John Hethcox Newbie

              Big ups to sverker! My head was starting to hurt from banging it against the wall. He's right, this question should be in a FAQ.