-1

I'm trying too add ssl to my server implementation. I'm having a problem when I want to compile the server.java. This is the output.

**Server.java:7: error: cannot find symbol
import javax.net.ssl.KeyStore;
                    ^
  symbol:   class KeyStore
  location: package javax.net.ssl
Server.java:8: error: cannot find symbol
import javax.net.ssl.KeyStorePassword;
                    ^
  symbol:   class KeyStorePassword
  location: package javax.net.ssl
Server.java:9: error: cannot find symbol
import javax.net.ssl.trustStore;
                    ^
  symbol:   class trustStore
  location: package javax.net.ssl
Server.java:10: error: cannot find symbol
import javax.net.ssl.trustStorePassword;
                    ^
  symbol:   class trustStorePassword
  location: package javax.net.ssl
Server.java:21: error: call to super must be first statement in constructor
        super(0, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory());
             ^
5 errors**

This is my server code, before adding the ssl worked perfect.

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.net.ssl.KeyStore;
import javax.net.ssl.KeyStorePassword;
import javax.net.ssl.trustStore;
import javax.net.ssl.trustStorePassword;


public class Server extends UnicastRemoteObject implements ServerInterface
{
    private static final long serialVersionUID = 1L;

    protected Server() throws RemoteException
    {

        super(0, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory());
    }

I only post this part because I think is an import problem with the ssl package. I'm using Ubuntu.

Thanks. Lucho.

2
  • Ubuntu has nothing to do with it.
    – user207421
    Apr 30, 2017 at 4:28
  • And neither do ubuntu-16.04, rmi, ssl, or jsse. You just wrote a whiole bunch of imaginary imports. Solution: don't.
    – user207421
    Oct 27, 2020 at 3:44

2 Answers 2

2

In Java up to and including Java 8:

  • there is no class called javax.net.ssl.KeyStore
  • there is no class called javax.net.ssl.KeyStorePassword
  • there is no class called javax.net.ssl.trustStore
  • there is no class called javax.net.ssl.trustStorePassword

Indeed, the last two class names don't even conform to the standard class naming conventions.

I only post this part because I think is an import problem with the ssl package. I'm using Ubuntu.

This does not indicate a problem with either Java or your Java installation or Ubuntu. The real problem is that the code you are trying to compile is plain wrong. Completely wrong. You cannot import classes that do not exist.


For what it is worth, there is a standard class called java.security.KeyStore, but nothing remotely resembling the other three.

0
1

There is no 'import problem with the ssl package'. There is a problem with you trying to import imaginary classes. You don't even seem to be using them, at least from what you posted. There are some system properties spelt almost, but not quite, that way:

javax.net.ssl.keyStore
javax.net.ssl.keyStorePassword
javax.net.ssl.trustStore
javax.net.ssl.trustStorePassword

Your final error is self-explanatory.

You don't need a serialVersionUID in a remote object.

In short your code is complete nonsense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.