java - how to enable https with org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer? -


i have encounter problem when try stepup https server resteasy-netty4 (http service ok)

----> resteasy version 3.0.16.final, java version 1.8)

by searching stackoverflow , google, got solutions, such as, simple java https server

yeah, original demo running successful, unfortunately, didn't work after integrated nettyjaxrsserver.

i creted sslcontext below:

public sslcontext getsslcontext1() throws exception {     sslcontext sslcontext = sslcontext.getinstance("tls");      // initialise keystore     char[] password = "password".tochararray();     keystore ks = keystore.getinstance("jks");     fileinputstream fis = new fileinputstream("{parent_path}\\testkey.jks");     ks.load(fis, password);      // setup key manager factory     keymanagerfactory kmf = keymanagerfactory.getinstance("sunx509");     kmf.init(ks, password);      // setup trust manager factory     trustmanagerfactory tmf = trustmanagerfactory.getinstance("sunx509");     tmf.init(ks);      // setup https context , parameters     sslcontext.init(kmf.getkeymanagers(), tmf.gettrustmanagers(), null);      return sslcontext.getdefault(); } 

and call org.immortal.hydra.gateway.server.jaxrsgatewayserver#setsslcontext enable https server.

it ok startup, failed serve.

caused by: javax.net.ssl.sslhandshakeexception: no cipher suites in common @ sun.security.ssl.alerts.getsslexception(alerts.java:192) @ sun.security.ssl.sslengineimpl.fatal(sslengineimpl.java:1666) @ sun.security.ssl.handshaker.fatalse(handshaker.java:304) @ sun.security.ssl.handshaker.fatalse(handshaker.java:292) @ sun.security.ssl.serverhandshaker.chooseciphersuite(serverhandshaker.java:1036) @ sun.security.ssl.serverhandshaker.clienthello(serverhandshaker.java:739) @ sun.security.ssl.serverhandshaker.processmessage(serverhandshaker.java:221) @ sun.security.ssl.handshaker.processloop(handshaker.java:979) @ sun.security.ssl.handshaker$1.run(handshaker.java:919) @ sun.security.ssl.handshaker$1.run(handshaker.java:916) @ java.security.accesscontroller.doprivileged(native method) @ sun.security.ssl.handshaker$delegatedtask.run(handshaker.java:1369) @ io.netty.handler.ssl.sslhandler.rundelegatedtasks(sslhandler.java:1124) @ io.netty.handler.ssl.sslhandler.unwrap(sslhandler.java:1009) 

if have suggestions fix this, please let me know.?

it looks you're setting ssl context returning default one. try changing

return sslcontext.getdefault(); 

to

return sslcontext; 

also it's useful learn how debug ssl enabling ssl logging: http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/readdebug.html


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -