1 Reply Latest reply on Mar 15, 2005 9:17 AM by Scott Stark

    Java Web Start: Connecting to the Server with a SandBoxed ap

    Damiano Altomare Newbie

      I'm using JBoss 4.0.1 sp1. I developed an application that downloaded from JBoss host via JWS (Java Web Start) connect to the same JBOSS host.
      When I try to connect to the host from the downloaded application I get:

      java.security.AccessControlException: access denied (java.net.SocketPermission <HOST IP ADDRESS> connect,resolve)

      The code to connect the server (EJBHOME Factory Pattern) is:

      String serverAddress = null;
      try {
      BasicService bs = (BasicService) ServiceManager.lookup ("javax.jnlp.BasicService");
      serverAddress = bs.getCodeBase().getHost();
      logger.info("Java Web Start is initialized - server address is: " + serverAddress + " ...");
      }
      catch (UnavailableServiceException e) {
      serverAddress = "localhost";logger.warn("Java Web Start is not initialized - assuming localhost is the the server address...");
      }

      Properties p = new Properties();
      p.pu(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, serverAddress);
      logger.info("Creating the initial ctx... ");
      ctx = new InitialContext(p);

      ...
      anEJBHome = (EJBHome) PortableRemoteObject.narrow(ctx
      .lookup(homeClass.getName()), homeClass);


      I DON'T WANT TO GIVE TO MY DOWNLOADED APPLICATION FULL PERMISSION, I DON't WANT TO CHANGE POLICY FILE WHERE THE APPLICATION RUN, because the application only need to access to the server wich it was downloaded and JWS specs assures that "Network connections are enabled only to the host from which the JAR files are downloaded".


      Damiano Altomare.