对于大学项目,我们需要实现一个服务器“注册器”,它通过 SSL RMI 连接与客户端“barowner”进行通信。构建客户端时,出现错误 java: No enum Constant javax.lang.model.element.Modifier.SEALED 构建错误。服务器构建没有任何问题。
BarownerMain.java
package com.example.BarOwner;
import com.example.registrar.RegistrarInterface;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class BarOwnerMain {
public static void main(String[] args) throws RemoteException {
String pass = "password";
System.setProperty("javax.net.ssl.debug", "all");
System.setProperty("javax.net.ssl.keyStore", System.getProperty("user.dir") + "/keys/raynaud.jks");
System.setProperty("javax.net.ssl.keyStorePassword", pass);
System.setProperty("javax.net.ssl.trustStore", System.getProperty("user.dir") + "/keys/raynaud.jks");
System.setProperty("javax.net.ssl.trustStorePassword", pass);
Registry registrarRegistry;
RegistrarInterface registrarInterface;
try {
registrarRegistry = LocateRegistry.getRegistry(
InetAddress.getLocalHost().getHostName(), 1112,
new RMISSLClientSocketFactory());
registrarInterface = (RegistrarInterface) registrarRegistry.lookup("RegistrarService");
BarOwnerMenu.showMenu(registrarInterface);
} catch (RemoteException | NotBoundException e) {
throw new RuntimeException(e);
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
我已经尝试按照 JDK-8244367 中的描述编辑 javax.lang.module,但 IntelliJ 不允许我这样做。任何帮助将不胜感激!