java - How to programmatically configure custom host in jetty server (8.1.8.v20121106) with SslSelectChannelConnector? -


i want access servlet https connection following address "https://ip-address:port/servletpath" . using sslselectchannelconnector jetty server (version 8.1.8.v20121106).

  1. i generated self signed certificate using keytool following information,

        cn=localhost, ou=<myorg>, o=<myorg>, l=trivandrum, st=kerala, c=in 
  2. i have configured jetty server - sslselectchannelconnector follows,

        sslcontextfactory sslfactory = new sslcontextfactory();     sslfactory.setkeystorepath("<path of generated key store keytool>");     sslfactory.setkeystorepassword("mypassword");     sslfactory.setkeymanagerpassword("mypassword");      sslfactory.settruststore("<path of signed trust store keytool>");     sslfactory.settruststorepassword("mypassword");      sslselectchannelconnector sslselectconnector = new sslselectchannelconnector(sslfactory);     sslselectconnector.setport(5443); 
  3. registered servlet path => servletpath follows,

     servletholder holder = new servletholder(httpservlet);   this.servletcontexthandler.addservlet(holder, servletpath); 
  4. when start server, getting console follows,

    info [main] (abstractconnector.java:338) - started sslselectchannelconnector@0.0.0.0:5443 debug [main] (abstractlifecycle.java:172) - started sslselectchannelconnector@0.0.0.0:5443

  5. when try access following address, //localhost:5433/servletpath => servlet getting invoked - executed successfully.

  6. in case need access => //192.168.27.29:5433/servletpath.

i tried set host "sslselectconnector.sethost("192.168.27.29"); ". when start server got console follows

info [main] (abstractconnector.java:338) - started sslselectchannelconnector@192.168.27.29:5443 debug [main] (abstractlifecycle.java:172) - started sslselectchannelconnector@192.168.27.29:5443 
  1. but when try access following address, //192.168.27.29:5433/servletpath => exection failed exception,

error image attached

so, how bind custom port jetty server, suggestions.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -