ssl 如何处理“java:没有枚举常量javax.lang.model.element.modifier.SEALED”构建错误?

lxkprmvk  于 2023-01-13  发布在  Java
关注(0)|答案(1)|浏览(2378)

对于一个大学项目,我们需要实现一个服务器“registrar”,它通过SSL RMI连接与客户端“barowner”通信。没有枚举常量javax.lang.model.element.Modifier.SEALED构建错误。服务器构建没有任何问题。

男爵主.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不允许。任何帮助都将不胜感激!

ulydmbyx

ulydmbyx1#

尝试将SDK版本更改为15,然后将其返回到更新后的版本。您可以在“项目结构”中更改您的DSK版本,快捷方式:
Ctrl+Alt+Shift+S组合键
"Project Structure" window in IntelliJ
确保单击“应用”按钮。
它帮我解决了同样的问题。

相关问题