Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running a server class :problem

843793Jul 10 2003 — edited Jul 13 2003
hi everyone,

i have a server class , with a policy file wich Allow everything, it's compiling well but when i trie to run it gives me an exception( see in the botom)???

this code in my policy file:

grant {
// Allow everything for now
permission java.security.AllPermission;

permission java.net.SocketPermission "*:1024-65535", "accept, connect, listen,resolve";

};


and this the code in my server class when i'm trying to link my server to my rmiregistry , in fact it's my rebind method who gives this exception
class Serveur{
// whatever
....
....
.....
public static void main(....)

// whatever
....
....
....
try
{
Serveur serv=new Serveur();

String objserv="//192.168.0.101:5000/serveurtemp";
Naming.rebind(objserv,serv);
System.out.println("the server is working.... ");
}

catch(Exception e)
{
System.out.println("serveur err: " + e.getMessage());
e.printStackTrace();

}// fin catch

the duty of this "server class" is to connect and to excute Queries on a databse located on the same machine as this "serveur" class and to return the results to a "client" ( a class in another machine )

i'm using a d-link rotor , and I've already seted a virtual TCP server on the 192.168.0.101 Ip on the port 5000 .

at least this is my excpetion while running



any kind of help i'll be greatfully
Thanks in Advance



serveur err: access denied (java.net.SocketPermission 192.168.0.101:5000 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.0.101:5000 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
at java.net.Socket.<init>(Socket.java:262)
at java.net.Socket.<init>(Socket.java:100)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at appserv.Serveur.main(Serveur.java:482)

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2003
Added on Jul 10 2003
3 comments
161 views