I'm trying to get Restlet 2.0.5 to work with HTTPS, with no luck.

I created a keystore in ~/.keystore (the default location) with a
password of 'changeit'. I can read it successfully, with this
password, using keytool.

However, when I try to set up a HTTPS Restlet server, I get this exception:

2011-03-17 15:35:22.640:INFO::jetty-7.3.1.v20110307
2011-03-17 15:35:22.660:WARN::FAILED
org.eclipse.jetty.http.ssl.SslContextFactory@38dda25b:
java.security.UnrecoverableKeyException: Password must not be null
2011-03-17 15:35:22.661:WARN::FAILED [email protected]:8081:
java.security.UnrecoverableKeyException: Password must not be null
2011-03-17 15:35:22.661:WARN::FAILED
org.restlet.ext.jetty.JettyServerHelper$WrappedServer@5ece2187:
java.security.UnrecoverableKeyException: Password must not be null
Exception in thread "main" java.security.UnrecoverableKeyException:
Password must not be null
        at 
sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:124)
        at 
sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:55)
        at java.security.KeyStore.getKey(KeyStore.java:779)
        at 
sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:131)
        at 
sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:68)
        at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:256)
        at 
org.eclipse.jetty.http.ssl.SslContextFactory.getKeyManagers(SslContextFactory.java:797)
        at 
org.eclipse.jetty.http.ssl.SslContextFactory.createSSLContext(SslContextFactory.java:781)
        at 
org.eclipse.jetty.http.ssl.SslContextFactory.doStart(SslContextFactory.java:199)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at 
org.eclipse.jetty.server.ssl.SslSocketConnector.doStart(SslSocketConnector.java:341)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.Server.doStart(Server.java:269)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at 
org.restlet.ext.jetty.JettyServerHelper.start(JettyServerHelper.java:395)
        at org.restlet.Server.start(Server.java:585)
        at org.restlet.Component.startServers(Component.java:600)
        at org.restlet.Component.start(Component.java:527)
        at TestSslServer.main(TestSslServer.java:47)

This is despite the fact that my program sets things up before starting:

    public TestSslServer() {
        Server server = getServers().add(Protocol.HTTPS, 8081);
        Series parameters = server.getContext().getParameters();
        parameters.add("keystorePath", "/home/usr2/jkarp/.keystore");
        parameters.add("keystorePassword", "changeit");
        parameters.add("keyPassword", "changeit");
        getDefaultHost().attach(new App());
    }

and also setting the configuration from the command line does not help:

java -Djavax.net.ssl.keyStorePassword=changeit
-Djetty.ssl.password=changeit -Djetty.ssl.keypassword=changeit -cp
'.:lib/*' TestSslServer

I have no idea where the 'null' password could be coming from. I
strace'd the Java process and it is finding the keystore file
successfully. Does anyone know what could be happening?

I've attached the source for the test.

-John

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2712238

Attachment: TestSslServer.java
Description: Binary data

Reply via email to