我正在研究Java RMI应用程序,并且在将服务器绑定到注册表时遇到问题.我正在使用rmi插件进行eclipse,在我不得不格式化我的电脑之前一切正常.此外,我确信代码是正确的,因为它是作为解决方案给我的那个,所以我的配置一定有问题.这是代码:
public static void main (String[] args){
try{
RMIChatServer myObject = new RMIChatServerImpl();
System.setSecurityManager(new RMISecurityManager());
Naming.rebind("Hello", myObject);
System.out.println("Remote object bound to registry");
}
catch( Exception e){
System.out.println("Failed to register object " + e);
e.printStackTrace();
System.exit(1);
}
}
Run Code Online (Sandbox Code Playgroud)
它给出的例外情况:
Failed to register object java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: access to class loader denied
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception …Run Code Online (Sandbox Code Playgroud) 我在prolog中有一个数据库,我要做的就是通过它的元素进行详细说明并逐个打印。如何才能做到这一点?
fact(is(mike,asthmatic)).
fact(has(andy,highPressure)).
fact(is(mike,smoker)).
Run Code Online (Sandbox Code Playgroud)
我已经写了这个,可以正常工作,但是它从数据库中删除了元素,所以我想不删除就访问它们。
print:-
retract(factA(P)),
write(factA(P)),nl,
fail.
print.
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 prolog 中编写一个简单的迷宫搜索程序,在向访问列表添加房间之前,我正在检查它是否已经是访问列表的成员。但是,即使我使用书中的代码,我也无法使其正常工作:
d(a,b).
d(b,e).
d(b,c).
d(d,e).
d(c,d).
d(e,f).
d(g,e).
go(X, X, T).
go(X, Y, T) :-
(d(X,Z) ; d(Z, X)),
\+ member(Z,T),
go(Z, Y, [Z|T]).
Run Code Online (Sandbox Code Playgroud)
我做错了什么?