- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下方法:
private void startServer() { // snippet that starts the server on the local machine
try {
RemoteMethodImpl impl = new RemoteMethodImpl();
Naming.rebind( "Illusive-Server" , impl );
} catch(Exception exc) {
JOptionPane.showMessageDialog(this, "Problem starting the server", "Error", JOptionPane.ERROR_MESSAGE);
System.out.println(exc);
}
}
抛出此异常:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Interfaces.RemoteMethodIntf
当我启动我的项目时,我在 JOptionPane 中收到一条消息,显示启动服务器时出现问题,然后出现上述异常。这可能是什么原因?
我不明白为什么最后一个异常声明说当我导入正确的包时找不到类。
最佳答案
此异常有四种情况。
导出时:您没有运行“rmic”,也没有执行 UnicastRemoteObject
的 Javadoc 序言中描述的步骤,从而使其变得不必要。
绑定(bind)时:注册表没有 stub 或远程接口(interface)或它们依赖于其类路径的东西。
查找时:客户端的类路径上没有这些东西。
调用远程方法时:您要么向 CLASSPATH 上不存在的类的服务器发送某些内容,要么从不在您的 CLASSPATH 上的类的服务器接收某些内容(包括异常):在这两种情况下可能是远程接口(interface)的方法签名中提到的类或接口(interface)的派生类或接口(interface)实现。
这是情况 2。注册表找不到指定的类。
有几种解决方案:
使用包含相关 JAR 或目录的 CLASSPATH 启动注册表。
通过 LocateRegistry.createRegistry() 在服务器 JVM 中启动注册表。
使用动态 stub ,如 UnicastRemoteObject 的 Javadoc 前言中所述。
但是,您仍然可能会遇到远程接口(interface)本身或其依赖的类的相同问题,在这种情况下,上述 1-3 仍然适用于该类/那些类。
确保不会发生上述情况 (4)。
使用代码库功能。这确实是一个部署选项,在我看来,在初始开发阶段应该避免这种情况。
关于java.rmi.ServerException : RemoteException occurred in server thread (ClassNotFoundException),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59919239/
1) 谁能帮助我了解“Remoteexception”的概念?一般是什么意思? 2) 另外,unwrapRemoteException 是什么意思?不确定它的意思是“如果这个远程异常包含一个 look
所以我为 Android 操作系统编写了一个服务和一个 Activity 。 我的服务在它自己的进程中运行,所以我的 Activity 和服务之间的所有通信都是通过 IPC 进行的。为此,我使用标准的
我有这个演示脚本,我将其放入 Jenkins 作业中: Write-Host "##############################################" $ErrorAction
我的 IntentService 中有以下代码,用于向注册的客户端发送 Message: for(Messenger client : clients) { client.send(aMess
我注意到HDFS删除命令将随机失败。例如,在MapReduce作业中,我在启动时删除目录。有时它会因以下错误而失败,但是在第二次尝试时会成功。 org.apache.hadoop.ipc.Remote
NullPointerException 是运行时异常的一个可能原因是因为每个方法都可以抛出它,所以每个方法都需要有一个“抛出 NullPointerException”,并且会很丑陋。但这发生在 R
我遵循了本教程:https://docs.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html#5 我在命令提示符下
我在我的 EC2 实例上设置了 CHD4。一切正常。 当我尝试访问时:http://ec2-00-000-000-000.us-west-1.compute.amazonaws.com:50075/w
我正在将信息输入数据库,但遇到一些 EJB 异常。信息的路径来自带有操作类的 JSP,它将值插入到远程 EJB 方法中,该方法内部(在该方法内)调用另一个方法来访问 hibernate,然后调用另一个
我有一个奇怪的问题。我正在尝试使用 RMI 编写一个简单的 Hello World java 程序。这是我的文件,全部属于同一个包: Hello.java: package com.something
我正在使用 ubuntu 15.04 进行 RMI 和 SQL 编程。我正在编写以下 3 个文件: ServerIntf.java 、 ServerImpl.java 和 Server.java 当我
我已将 Eclipse 设置为生成有关缺少 Javadoc 标记的警告。但是,我想抑制针对 RMI 接口(interface)缺少 @throws RemoteException 标记的警告,因为这些
这是我想要强制抛出远程异常的代码: transient Bicycle b=null; public Bicycle getBicycle() { if(b==null) {
我想将一些文件从 Windows 机器复制到在 SingleNode 上的 ubuntu 14.04.02 上运行的 hadoop。这是用于此目的的代码; Configuration configur
我无法使用 Hadoop 的 WebHDFS REST API 创建文件。 按照文档,我正在这样做。 curl -i -X PUT "http://hadoop-primarynamenode:500
我正在运行hadoop群集,其中Ubuntu主机作为主从服务器,虚拟机在其上作为另一个从属服务器运行(2节点群集)。 似乎应该在No data nodes are started上解决的问题的解决方案
以下方法: private void startServer() { // snippet that starts the server on the local machine
以下方法: private void startServer() { // snippet that starts the server on the local machine
以下方法: private void startServer() { // snippet that starts the server on the local machine
以下方法: private void startServer() { // snippet that starts the server on the local machine
我是一名优秀的程序员,十分优秀!