JinXi Li

Greenhorn
+ Follow
since Mar 12, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by JinXi Li

Thanks for everyone!
I have solved the problem with policy file!
Thanks again!
Thank you!
But I have started rmiregistry!
For using rmi,I write a examples for test.But when I run server side program,there is error.Like:
HelloImpl err:access denied (java.net.SocketPermission 127.0.0.1:1099 connect,re
solve)
java.security.AccessControlException: access denied (java.net.SocketPermission 1
27.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.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(RMIDirect
SocketFactory.java:25)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.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 examples.hello.HelloImpl.main(HelloImpl.java:17)

Who can help me to solve the problem.
Here is my code:
package examples.hello;
import java.rmi.*;
public interface Hello extends Remote {
String sayHello() throws RemoteException;
}

package examples.hello;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class HelloImpl extends UnicastRemoteObject implements Hello {
private String name;
public HelloImpl(String s) throws RemoteException {
super();
name = s;
}
public String sayHello() throws RemoteException {
return "Hello Zeng Gang";
}
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
try {
HelloImpl obj = new HelloImpl("HelloServer");
Naming.rebind("/HelloServer",obj);
System.out.println("HelloServer bound in registry");
}
catch(Exception e) {
System.out.println("HelloImpl err:"+e.getMessage());
e.printStackTrace();
}
}
}
Another question: How to use policy file?
Thanks!
Thank you Bal Sharma.
If I have any problem I will ask you for advice.
:-)

Originally posted by Bal Sharma:
Hello china, welcome to SCJD land. I hope you have RHE book right! Second half of the book is targetted to scjd. However, it might not be complete package for scjd certification. First of all download assignment, read posting here, start coding. If something is unclear to you, research here, ask here. SWING, RMI OR SCOKET connection is needed to complete assignment. Keep going and have fun.
-Bal

Now my user name is changed!My name is Hui Li.
I am from china! Say hello to everyone here!
Thanks for Mark!
Thank you!Mark
I will change my Login!
Thank for your advice!I will take it!
I pass the SCJP.Now I want to take the SCJD exam.How can I get to prepare the SCJD exam.Who can give me some advive.Or get me some examples.Thanks a lot!
[email protected]