已停止後,我在重新啓動我的RMI註冊表中的一個問題:無法啓動RMI服務器它
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.UnicastRemoteObject;
import javax.swing.JOptionPane;
public class CinemaServer
{
private Registry registry;
ClientImpl clientImple; //remote interface implemented class
private static String title="Cinema Pvt Ltd";
public CinemaServer() {
try {
clientImple = new ClientImpl();
registry=LocateRegistry.createRegistry(3311);
registry.rebind("RMI_INSTANCE", clientImple);
} catch (RemoteException e) {
JOptionPane.showMessageDialog(null, "Can't Start RMI Server",title,JOptionPane.ERROR_MESSAGE);
}
}
public void stopServer()
{
try {
registry.unbind("RMI_INSTANCE");
UnicastRemoteObject.unexportObject(clientImple, true);
} catch (NotBoundException e) {
JOptionPane.showMessageDialog(null, "Can't Stop Server",title,JOptionPane.ERROR_MESSAGE);
}
}
}
我啓動服務器:
CinemaServer ser=new CinemaServer();
當我撥打
ser.stopServer();
時,它停止。但我不能重新啓動它
我越來越:
java.rmi.server.ExportException: internal error: ObjID already in use
at sun.rmi.transport.ObjectTable.putTarget(Unknown Source)
at sun.rmi.transport.Transport.exportObject(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.exportObject(Unknown Source)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unknown Source)
at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
...
您可以粘貼您收到的錯誤消息嗎?當您嘗試重新啓動時會發生什麼? – 2011-06-13 14:59:11
我收到「java.rmi.server.ExportException:內部錯誤:ObjID已在使用中」錯誤 – sanu 2011-06-13 15:05:17
您可以發佈堆棧跟蹤嗎? – Mikaveli 2011-06-13 15:11:37