2 Replies Latest reply on Oct 3, 2007 9:53 AM by Alfredo Anderson

    JWS rmi on EJB fails with AccessControlException: access den

    Sebastian Brosch Newbie

      Hello,

      i`m having a problem with my JWS Application which should call an EJB and a persistence unit. Obviously it`s a problem with the rights granted to web start applications. The server works as it should and the lookup of the BeanInterface works correct. If i call a method of this object the error occurs.

      Exception in thread "AWT-EventQueue-0" java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
      at java.security.AccessController.checkPermission(AccessController.java:427)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
      at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
      at java.lang.Class.checkMemberAccess(Class.java:2125)
      at java.lang.Class.getDeclaredMethods(Class.java:1762)
      at org.jboss.aop.util.MethodHashing.getInterfaceHashes(MethodHashing.java:150)
      at org.jboss.aop.util.MethodHashing.calculateHash(MethodHashing.java:219)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:79)
      at $Proxy0.getClient(Unknown Source)
      at com.planetactive.ejb.client.EditClient.getUser(EditClient.java:53)
      at com.planetactive.ejb.client.EditClient.jButton1MouseClicked(EditClient.java:140)
      at com.planetactive.ejb.client.EditClient.access$000(EditClient.java:24)
      at com.planetactive.ejb.client.EditClient$1.mouseClicked(EditClient.java:82)
      at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
      at java.awt.Component.processMouseEvent(Component.java:5557)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
      at java.awt.Component.processEvent(Component.java:5319)
      at java.awt.Container.processEvent(Container.java:2010)
      at java.awt.Component.dispatchEventImpl(Component.java:4021)
      at java.awt.Container.dispatchEventImpl(Container.java:2068)
      at java.awt.Component.dispatchEvent(Component.java:3869)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3945)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
      at java.awt.Container.dispatchEventImpl(Container.java:2054)
      at java.awt.Window.dispatchEventImpl(Window.java:1774)
      at java.awt.Component.dispatchEvent(Component.java:3869)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

      My JWS code:

      private void initJndi() throws NamingException {
       Hashtable env = new Hashtable();
       env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      
       final Context ic = new InitialContext(env);
       client = (ClientRemote)ic.lookup("ClientBean/remote");
      }
      private TemControlClient getUser() {
       try {
       java.lang.Integer id = java.lang.Integer.parseInt(jTextField1.getText());
       userTemp = client.getClient(id);
       } catch (RemoteException ex) {
       Logger.getLogger("global").log(Level.SEVERE, null, ex);
       }
       return userTemp;
      }


      the error is thrown at this line:

      userTemp = client.getClient(id);


      userTemp is an instance of my PersistenceUnit and client is the looked up bean.

      the security settings in my JNLP file are the following:

      <security>
       <all-permissions/>
      </security>


      I hope somone can help me.

      Thanks in advance