For a University project we need to implement a server 'registrar' that communicates with a client 'barowner' through a SSL RMI connection. When building the client, I get the error java: No enum constant javax.lang.model.element.Modifier.SEALED build error. The Server gets build without any problems.
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();
}
}
}
I already tried editing javax.lang.module as desribed in JDK-8244367 but IntelliJ doesn't let me. Any help would be appreciated!
Try to change the SDK version to 15, and then return it to the updated version. You can change your DSK version in the "Project Structure", shortcut to get there:
ctrl+alt+shift+S
"Project Structure" window in IntelliJ
Make sure you click the "Apply" button.
It helps me solve the same problem.