Gordon Swan

Greenhorn
+ Follow
since Jan 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gordon Swan

Hi Martijn

I have done the edit. I hope this will this is alright now.

Gordon
15 years ago

Gordon Swan wrote:I am trying to run this example program using Neatbeans 6.1 but I am getting errors when I use the Security Manager. Could someone give me an idea how to use the Security Manager in Netbeans? This is the Security Policy file I am using:

Policy file:

grant {
permission java.security.AllPermission;
};


The Server:




These are the errors I am getting:

java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:513)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at rmi.StudentEnrollment.main(StudentEnrollment.java:30)


G Swan

15 years ago
Hi Martijn

I am not sure what you mean. Could please expand a bit.

G Swan
15 years ago
I am trying to run this example program using Neatbeans 6.1 but I am getting errors when I use the Security Manager. I am attaching the file so could someone give me an idea how to use the Security Manager in Netbeans? This is the Security Policy file I am using:

Policy file:

grant {
permission java.security.AllPermission;
};


The Server:





These are the errors I am getting:

java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:513)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at rmi.StudentEnrollment.main(StudentEnrollment.java:30)


G Swan
15 years ago
Hello Mike

This is the code I used to set up the Security Manager:

System.setProperty("java.security.policy", "RMISecurity.policy");
if(System.getSecurityManager()== null)
{
System.setSecurityManager(new RMISecurityManager());
}

I am using the the following policy file which is in my package folder:

grant {
permission java.security.AllPermission;
};

Where should I insert the following line:

java -Djava.security.policy=policyfilename


G Swan


15 years ago
Could anyone point me to a simple updated tutorial for creating an RMI project in netbeans?

G Swan
I am creating an RMI project in netbeans but when I setup the Security Manager, access is denied but the code runs perfect without it. Could someone give me a simple example to show how to run the code with the Security Manager? I need it for an assigment.

G Swan
15 years ago