0 Replies Latest reply on Jul 31, 2006 11:37 AM by Rajeev Malhotra

    Getting AccessControlException from Applet trying to call EJ

    Rajeev Malhotra Newbie

      I am getting the following exception while trying to access EJB deployed on JBoss 4.0.3SP1 from an Applet:

       at org.jboss.proxy.SecurityInterceptor$3.run(SecurityInterceptor.java:87)
      Caused by:java.security.AccessControlException:access denied (java.util.PropoertyPermission org.jboss.security.SecurityAssociation.ThreadLocal read)

      The exception is thrown from the line "inBox = inBoxHome.create();" in the following block of code:
       * @return a InBoxBean object
       * @throws java.lang.Exception
       public InBox getInBoxBean() throws Exception
       InBox inBox = null;
       Object ref = null;
       //look up jndi name
       ref = _context.lookup("InBoxBean");
       catch (Exception ex)
       System.out.println("_context.lookup('InBoxBean') failed with: "+ ex);
       //look up jndi name again
       ref = _context.lookup("InBoxBean");
       System.out.println("_context.lookup('InBoxBean') succeeded:");
       //then cast to Home interface
       InBoxHome inBoxHome = (InBoxHome)PortableRemoteObject.narrow(ref, InBoxHome.class);
       // use Home interface to create remote interface
       inBox = inBoxHome.create();
       catch (Exception e)
       throw e;
       return inBox;

      The only way I have been able make this work is by running the Java Plug-in on the client with security manager with the following policy:

      grant {
       permission java.util.PropertyPermission "org.jboss.security.SecurityAssociation.ThreadLocal", "read";
       permission java.lang.RuntimePermission "org.jboss.security.SecurityAssociation.getPrincipalInfo";
       permission java.io.SerializablePermission "enableSubstitution";

      Is there a way to make this work without have to do anything special on the client plug-in.