0

I am trying to implement Rest web service(Server) with https protocol.

I am getting Warning while starting server: WARNING: No available server connector supports the required protocols: 'HTTPS' . Please add the JAR of a matching connector to your classpath.

Lib used: 1) org.restlet-2.0.0.jar 2) com.noelios.restlet.ext.simple_3.1.jar 3) org.simpleframework_3.1/org.simpleframework.jar 4) com.noelios.restlet.ext.ssl.jar 5) org.jsslutils_0.5/org.jsslutils.jar

Sample code:

import org.restlet.resource.ServerResource;
import org.restlet.data.Parameter;
import org.restlet.data.Protocol;
import org.restlet.util.Series;
import org.restlet.Component; 
import org.restlet.Server;

public class RestServerResource extends ServerResource {

public static void main(String[] args) throws Exception {
    // Create a new Restlet component and add a HTTP server connector to it 
    Component component = new Component();  
    Server server = component.getServers().add(Protocol.HTTPS, 8183); //https secure protocol

    component.getDefaultHost().attach("/", RestServerResource.class); 
    Series<Parameter> parameters = server.getContext().getParameters();

    parameters.add("sslContextFactory", "org.restlet.ext.ssl.PkixSslContextFactory");
    // I have created self signed certificate. reference is attached with parameter
    parameters.add("keystorePath","${user.home}/serverX.jks");
    parameters.add("keystorePassword", "password");
    parameters.add("keyPassword", "password");
    parameters.add("keystoreType", "JKS");  

    component.start();
}}

Can anyone suggest, why i am getting above warning and unable to start server. Thanks in advance for early reply.

Regards Vicky

vikas jha
  • 1
  • 1

2 Answers2

0

I have done. There was a jar issue. It requires list of jar mentioned above from same distribution(i.e 2.0.0 or 2.0.14 etc). Should not pick jar from different version or other location as mentioned (e.g org.simpleframework_3.1) in Restlet API doc.

vikas jha
  • 1
  • 1
  • I'm having the same issue. Could you point out where you picked those jars from? I don't see the simple framework related jars in my distribution of v2.0.15 – curioustechizen Jul 17 '13 at 14:02
0

might be using old version of restlet , here is the pom file dependencies, i have

<dependencies>
<dependency>  
   <groupId>org.restlet.jse</groupId>  
   <artifactId>org.restlet</artifactId>  
   <version>2.0.0</version>  
</dependency>  
<dependency>  
   <groupId>org.restlet.jse</groupId>  
   <artifactId>org.restlet.ext.simple</artifactId>  
   <version>2.0.0</version>  
</dependency>  
  </dependencies>