需要启动rmiregistry
参见
http://ubuntuforums.org/showthread.php?t=1278660
The actual reason is the rmiregistry service on your machine is not running......u hav two ways to solve it......
1) start terminal, type "rmiregistry" (without quotes) & hit enter. it will look like something has hanged up....but the service has been started........run your code now & things will work (only till the terminal looks in hanging state). closing the terminal or stopping the rmiregistry by ctrl+c will stop it.
2) second way is to add following snippet in your code -
static
{
try
{
LocateRegistry.createRegistry(1099);
}
catch (RemoteException e)
{
e.printStackTrace();
}
}
this will start the service till your code is running (on the default port 1099).

本文详细介绍了在Ubuntu环境下,当RMIREgistry服务未运行导致代码无法正常工作时,通过两种方法来解决问题:一是直接在终端中启动服务;二是将服务启动代码集成到应用中,确保服务在应用运行期间一直保持开启状态。
4万+

被折叠的 条评论
为什么被折叠?



