Tag: rmi

java / spring-在org.springframework.context.support.AbstractApplicationContext中获取NoClassDefFoundError

我正在尝试初始化我使用过Spring的RMI客户端。 现在,应用程序的RMI上下文存储在file = rmiClientAppContext.xml中 使用上述文件的相关代码如下 – //RMI Client Application Context is started… ApplicationContext context = new ClassPathXmlApplicationContext(“rmiClientAppContext.xml”); 但是,当我尝试运行程序时,这就是我得到的错误 – Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:164) at org.springframework.context.support.AbstractRefreshableApplicationContext.(AbstractRefreshableApplicationContext.java:90) at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.(AbstractRefreshableConfigApplicationContext.java:59) at org.springframework.context.support.AbstractXmlApplicationContext.(AbstractXmlApplicationContext.java:61) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:136) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) 在进一步调查上面的第一行错误信息时,我发现了这一点 “164 is not a valid line number in org.springframework.context.support.AbstractApplicationContext” 我在这做错了什么? 我正在使用Spring v3.1.3如何解决上述错误? 另外,我必须为RMI客户端准确包含哪些JAR? 是否有任何特定的顺序可以将这些JAR添加到Eclipse中的Java构建路径中?

Java RMI:更新服务器中的客户端对象

我正在尝试使用Java RMI在分布式系统中实现用于组通信的中间件。 在那里,我需要将一个对象发送到服务器并进行修改。 所以这些变化应该反映在客户端。 例如,我将在Oracle网站上提供最常见的教程。 X.java public class X implements Serializable, Remote{ public int x; // defined as public, just be simple. } Hello.java import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello(X c) throws RemoteException; } Server.java import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.server.UnicastRemoteObject; public class Server implements Hello { public Server() […]

Java RMI服务器和Objective C客户端

我有一个java rmi服务器和一个客观的C客户端。 我想使用RMI到HTTP隧道,以便将RMI调用封装到HTTP请求中,其中RMI servlet处理程序可以将调用转发到相应的rmi服务器。 但是我面临一个问题。 例如,假设我创建了存根,并使用某个名称(在服务器端)将注册表绑定在注册表上。 现在在目标C中,我如何找到注册表并查找存根? 因为在我们有rmi客户端的正常情况下,可以这样做: Registry registry = LocateRegistry.getRegistry(host); Hello stub =(Hello)registry.lookup(“HelloServer”); 这些不是远程过程调用,我可以在http请求中发送服务器来处理它们。 那么如何在客观的C客户端中“定位”服务器远程对象呢? 任何帮助表示赞赏,如果您需要更多信息,请告诉我。

RMI问题 – 客户端在哪里获取尚未添加到注册表的远程类的定义?

我设法创建了一个RMI应用程序,它完成了我需要它做得非常成功的事情,但是我很难解决客户端获取远程对象定义的问题。 例如: 我有一个服务器,它使用rmiregistry注册自己(允许客户端调用方法)。 UnicastRemoteObject.exportObject(new Server(), 0); 运行reg.list()确认我的服务器确实已添加到注册表中。 我有另一个远程对象(rObj)在与服务器相同的JVM上运行。 这不会添加到注册表中。 在我的客户端中,我可以通过在rmiregistry中查找Server来获取我的Server类的定义: reg.lookup(“Server”) 之后可以自由创建rObj的实例。 我的问题的关键是,我的客户端在哪里获得rObj的定义,即使它从未被添加到注册表中。 我知道它必须来自服务器,因为存储类和接口的地方。 与Server的连接是否会自动打开管道以接收其他远程类? 如果是这样,客户端如何知道在服务器上查找远程类。 是否将服务器视为客户端类路径的扩展(它将使用检查服务器中不在其自己的类路径中的类)?

RMI多个客户端

RMI是否自己处理多个客户端? 即 是否可以同时使用多个客户端的服务器function? 如果不是,我怎么能做这样的事情? 如果是的话,它是如何工作的? 它为每个电话创建一个新线程吗? 如果一个客户端阻止该function,下一个客户端会发生什么? 等等

rmi java.lang.ClassNotFoundException:testrmi2.fileserverimpl_Stub

大家好我正在编写一个简单的rmi应用程序,但我有一个问题。 如果我在同一目录中运行注册表,它的工作原理; 但如果我改变我运行注册表的目录不会。 我认为这种情况不可能发生。 注册表通常会从另一台主机上运行,​​但只有目录的更改才会停止其function。 我正在解决这个问题3天没有解决方案,我也改变了codebase参数的每个可能的配置,但没有。 我用目录描述了情况和代码: fileserver.java: `package testrmi2; import java.rmi.*; public interface fileserver extends Remote { public void scrivifile(String nomefile, String arg) throws RemoteException; } `fileserverimpl.java: package testrmi2; import java.io.*; import java.rmi.*; import java.rmi.server.*; public class fileserverimpl extends UnicastRemoteObject implements fileserver{ public fileserverimpl() throws RemoteException { super(); } public void scrivifile(String nomefile, String […]

Java ArrayList / RMI

我已经建立了一个简单的项目类; class itemInfo{ int auctionID; int startPrice; int buyoutPrice; } 我创建了一个ArrayList; ArrayList itemSet = new ArrayList(); 我在这里也有一个允许用户创建项目的方法(方法不完整,我到目前为止只尝试实现选择== 1!); public void auctionChoice(){ System.out.println(“—- What would you like to do? —-\n”); System.out.println(“1: List an item for auction\n”); System.out.println(“2: Bid on an existing item\n”); System.out.println(“3: Remove an item from the auction\n”); if(scanner.next().equals(“1”)){ itemInfo createdItem = new itemInfo(); System.out.println(“—-Enter […]

将远程对象反序列化为最窄的可访问类

在shared.jar中我有: abstract class MyParent { } abstract class MyClass { MyParent getFoo(); } server.jar包含 abstract class MyChild extends MyParent { } abstract class MyClassConcrete { MyParent getFoo() {return new MyChild();} } client.jar : MyParent foo = myClass.getFoo(); 如果所有3个jar子都在一个类加载器中,一切都运行良好。 但客户端和服务器位于不同的JVM中,而: JVM-1包含: server.jar , shared.jar JVM-2包含: client.jar , shared.jar 客户端调用服务器。 服务器返回MyConcreteClass ,Java无法反序列化它( ClassNotFoundException )。 我想做什么: 服务器序列化类并发送数据和类的祖先集 客户端找到它可能反序列化的最窄的祖先。 […]

RMI无法连接到远程服务器

我最近一直在使用RMI,当我设法让它在locahost工作时,我在尝试使用远程服务器时遇到了各种各样的问题。 这是我正在尝试运行的基本代码: 服务器: public class RmiServer extends UnicastRemoteObject implements RmiServerIntf { public static final String MESSAGE = “Hello world”; public RmiServer() throws RemoteException { } public String getMessage() { return MESSAGE; } public static void main(String args[]) { System.out.println(“RMI server started”); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); System.out.println(“Security manager installed.”); } else { System.out.println(“Security […]

干净的方式来停止RMI服务器

没有stopServerfunction的RMI服务器工作正常。 public class HelloServer extends UnicastRemoteObject implements HelloInterface { private final static int PORT=1102; private final String serverName=”server”; private Timer timer; public HelloServer() throws RemoteException { timer = new Timer(); //At this line a new Thread will be created timer.schedule(new StopServerTask(), 5000); } @Override public String serverResponse(String request) throws RemoteException { return “Hello”+request; } public […]