java.rmi.server.codebase 在 linux 上不工作

标签 java rmi java-7 classnotfoundexception codebase

我正在使用 rmi 开发 Twitter 之类的东西。 我在 Windows 上工作,一切正常。

但是在 linux 上我有:

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
    java.lang.ClassNotFoundException: server.SimpleBark
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:196)
    ...

这个异常是在客户端弹出的,看来客户端没有使用代码库服务器,代码库服务器没有收到任何连接。

我重复一遍,在 Windows 上一切正常,我找不到它的来源。

最佳答案

From the JDK 7 guides

From JDK 7 Update 21, the RMI property java.rmi.server.useCodebaseOnly is set to true by default.

From the JDK 7 guides, that hasn't been updated

java.rmi.server.useCodebaseOnly

If this value is true, automatic loading of classes is prohibited except from the local CLASSPATH and from the java.rmi.server.codebase property set on this VM. Use of this property prevents client VMs from dynamically downloading bytecodes from other codebases. This property is ignored in the implementations of 1.2 and 1.2.1 because of a bug.

因此,您的 Windows 计算机上的 Java 版本似乎已过时。更新后,解决此问题的最佳方法是在客户端包含所需的类,而不是通过网络动态加载类。

关于java.rmi.server.codebase 在 linux 上不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16884047/

相关文章:

Java版本错误

java - 由于 SSL 问题,无法使用 JDBC 连接到 Azure(基于连接字符串和提供的示例)

java - 在 Java 9 中,是否可以使用 RMI 替代 HTTP 隧道?

java - JDK7半透明+jframe+jcombobox

java-7 - Java 7 中的新特性

osgi - 适合 ERP 等应用程序的框架

java - 无法实例化类型配置 Mirror API

java - 检索给定 objectId 的 ParseObject 的 ACL

java - 对我的 Java 项目进行 Coverity 静态分析时出现 "intermediate directory contains no translation units"错误

Java RMI :Updating client side objects in the server