----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 16, 1999 8:22 AM
Subject: RE: Installation problem


>
> Dirk,
>
> I had to put the following line in my policy file:
>
> grant {
>     permission java.util.PropertyPermission "*", "read,write";
> }
>
> Of course, I'm just doing this to get things working right now.  I'll
worry
> about the proper
> settings later, but this should get you going.
>
>

I thought that maybe someone would be interested in how I handle this...

I've written a Java class for starting Jonas that sets the System
SecurityManager and starts an RMIRegistry before starting Jonas.
I install my own SecurityManager before starting Jonas so that it is not
necessary to modify the policy file for JDK 1.2.
I also start an RMIRegistry before starting Jonas as a convenience, so that
I don't have to start a registry separately.

I have included below the code for my class that starts Jonas,
AccountSystemStarter.java, and the code for my SecurityManager,
PermissiveSecurityManager.java.


ted stockwell


############AccountSystemStarter.java##########
package eb;

import java.net.*;
import java.rmi.*;
import java.rmi.registry.*;
import java.util.Properties;

import com.gt.util.PermissiveSecurityManager;

/**
This class starts up Jonas an a naming service in a single process.
@author  ted stockwell
 */
public class AccountSystemStarter {

    public static void main(String[] args)
    throws Throwable
    {
        /////////////////////////
        //
        // install security manager
        //
        System.setSecurityManager(new PermissiveSecurityManager());

        Properties sysProperties= System.getProperties();
        sysProperties.put("java.naming.provider.url", "rmi://localhost");
        sysProperties.put("install.root", "/jonas_jdk1.1");
        System.setProperties(sysProperties);

        ///////////////////
        //
        //  Start a local RMI registry if one is not already started.
        //
        try {
            LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
        }
        /*
        If we failed to get a reference to a local registry then try to
        restart the local registry
        */
        catch (RemoteException x) {
            LocateRegistry.getRegistry();
        }

        ///////////////////
        //
        //  Start the Jonas server
        //
        org.objectweb.jonas.server.Server.main(new String[0]);
    }
}
############AccountSystemStarter.java##########



############PermissiveSecurityManager.java##########
/**
A default security manager that grants all permissions.
An instance of this class is typically used by server applications that
need to use a security manager but don;t want to use the
RMISecurityManager.

author  ted stockwell
*/
public class PermissiveSecurityManager
extends SecurityManager
{
    public boolean getInCheck() { return false; }

    public PermissiveSecurityManager() { }

    public void checkPermission(Permission perm) { }
    public void checkPermission(Permission perm, Object context) { }
    public void checkCreateClassLoader() { }
    public void checkAccess(Thread t) { }
    public void checkAccess(ThreadGroup g) { }
    public void checkExit(int status) { }
    public void checkExec(String cmd) { }
    public void checkLink(String lib) { }
    public void checkRead(FileDescriptor fd) { }
    public void checkRead(String file) { }
    public void checkRead(String file, Object context) { }
    public void checkWrite(FileDescriptor fd) { }
    public void checkWrite(String file) { }
    public void checkDelete(String file) { }
    public void checkConnect(String host, int port) { }
    public void checkConnect(String host, int port, Object context) { }
    public void checkListen(int port) { }
    public void checkAccept(String host, int port) { }
    public void checkMulticast(InetAddress maddr) { }
    public void checkMulticast(InetAddress maddr, byte ttl) { }
    public void checkPropertiesAccess() { }
    public void checkPropertyAccess(String key) { }
    public boolean checkTopLevelWindow(Object window) { return true; }
    public void checkPrintJobAccess() { }
    public void checkSystemClipboardAccess() { }
    public void checkAwtEventQueueAccess() { }
    public void checkPackageAccess(String pkg) { }
    public void checkPackageDefinition(String pkg) { }
    public void checkSetFactory() { }
    public void checkMemberAccess(Class clazz, int which) { }
    public void checkSecurityAccess(String target) { }
}
############PermissiveSecurityManager.java##########

Reply via email to