Search code examples
servletshttpskeystorerestlet

restlet establishing secure connection stuck


I am trying to use HTTPS with restlet to host my own server. I have a maven project, with the following dependencies:

    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet</artifactId>
        <version>${restlet-version}</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.ssl</artifactId>
        <version>${restlet-version}</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.net</artifactId>
        <version>${restlet-version}</version>
    </dependency>

Version is 2.2-M3 but I also tried with M6 and any other versions I could find. This is the code I use to setup the server:

    Server server = component.getServers().add(Protocol.HTTPS, 8182);

    Series parameters = server.getContext().getParameters();
    parameters.add("sslContextFactory",
    "org.restlet.ext.ssl.DefaultSslContextFactory");
    parameters.add("keyStorePath", "localhost.jks");
    parameters.add("keyStorePassword", "parkingads");
    parameters.add("keyPassword", "parkingads");
    parameters.add("keyStoreType", "JKS");

    component.getDefaultHost().attach("", new App());
    component.start();

I followed the guide at to set everything up, including the keystore: https://restlet.com/open-source/documentation/user-guide/2.2/core/security/https

However, when I make requests, it just gets stuck loading forever until the client (browser, postman, or my own) just timesout. In chrome for example, all I see is : Establishing secure connection , in bottom left.


Solution

  • The way I solved it in the end was by using 2.2.1 restlet and 1.0.5 jsslutils. I did not change from DefaultSslContextFactory, which is suggested for 2.3, while for 2.2, PkixSslContextFactory should work, but it did not for me.