"Ungrantable protection domain" exception

Pawe³ Banasik <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <LISTSERV%[email protected]>
Hello,

I'm developing a Blitz JavaSpace Server management module for Netbeans.
Currently, I'm trying to write a piece of code, which would start the JINI
activation system (Phoenix). Normally, this is done by executing the
following command line, which invokes the ServiceStarter's main function:

$JAVA_HOME/bin/java -Djava.security.policy=policy/policy.all -jar
$JINI_HOME/start.jar config/start-phoenix.config

Since I'd like to do this in my code (and ServiceStarter's methods are
private), I've extracted the following lines from main():

File f = InstalledFileLocator.getDefault().locate(PHOENIX_CONFIG_PATH,
null, false);

Configuration config = null;
ServiceDescriptor[] descs = null;

        try {
          config = ConfigurationProvider.getInstance(new
String[] {f.getAbsolutePath()});

          descs = (ServiceDescriptor[])
                        config.getEntry(START_PACKAGE, "serviceDescriptors",
                        ServiceDescriptor[].class, null);

        } catch (ConfigurationException ex) {
            ex.printStackTrace();
        }

        for (int i = 0; i < descs.length; i++)
            {
                Object result = null;
                try {
                    result = descs[i].create(config); // EXCEPTION!!!
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }

The problem is that I'm getting an exception when trying to execute the
ServiceDescriptor's create() method:

java.lang.UnsupportedOperationException: ungrantable protection domain
        at
net.jini.security.policy.DynamicPolicyProvider.checkDomain(DynamicPolicyProvider.java:297)
        at
net.jini.security.policy.DynamicPolicyProvider.grant(DynamicPolicyProvider.java:196)
        at
com.sun.jini.start.LoaderSplitPolicyProvider.grant(LoaderSplitPolicyProvider.java:197)
        at
com.sun.jini.start.NonActivatableServiceDescriptor.create(NonActivatableServiceDescriptor.java:606)


This is the fragment of the DynamicPolicyProvider's code where the
exception is being thrown:

    private static void checkDomain(final Class cl) {
 ProtectionDomain pd = (ProtectionDomain)
AccessController.doPrivileged(
     new PrivilegedAction() {
  public Object run() { return cl.getProtectionDomain(); }
     });
 if (pd != sysDomain && pd.getClassLoader() == null) {
     throw new UnsupportedOperationException(
  "ungrantable protection domain");
 }
    }

Clearly, this is some security problem with protection domains. "sysDomain"
is the Object class' protection domain, which indeed isn't equal to "pd" -
the ServiceDesciptor class' domain. I have no idea why this is the case and
how to solve this problem. I'd appreciate any help.

Pawe³ Banasik

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.