2013/11/1 Matthew Westwood-Hill <matthew.westwood-h...@nuix.com> > > Tomcat version: 7.0.47 > > OS: Windows 7 (x64) > > JDK: 1.7 > > > > I am attempting to start an embedded instance of Tomcat, which is > configured for SSL only, on port 443. The code I am using is as follows: > > > > *public* *static* *void* *main*(String[] args) > *throws*UnknownHostException, LifecycleException, ServletException { > > Tomcat tomcat = *new* Tomcat(); > > > > tomcat.setBaseDir("D:\\Temp"); > > tomcat.addWebapp("/sslapp", "D:\\"); > > > > Connector connector = *new* Connector(); > > connector.setPort(443); > > connector.setScheme("https"); > > connector.setSecure(*true*); > > > > connector.setAttribute("address", "127.0.0.1"); > > connector.setAttribute("SSLEnabled", *true*); > > > > connector.setAttribute("bindOnInit", *true*); > > > > connector.setAttribute("keystoreFile", > "...\\EngineInstance.keystore"); > > connector.setAttribute("keystorePass", "password"); > > connector.setAttribute("clientAuth", "false"); > > connector.setAttribute("sslProtocol", "TLS"); > > connector.setAttribute("keyAlias", "test"); > > connector.setAttribute("keyPass", "password"); > > > > tomcat.setConnector(connector); > > tomcat.init(); > > tomcat.start(); > > tomcat.getServer().await(); > > > > } > > > > When I run the above, I receive the following output: > > > > Nov 01, 2013 10:08:07 AM org.apache.catalina.core.StandardService > startInternal > > INFO: Starting service Tomcat > > Nov 01, 2013 10:08:07 AM org.apache.catalina.core.StandardEngine > startInternal > > INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 > > Nov 01, 2013 10:08:07 AM org.apache.catalina.startup.ContextConfig > getDefaultWebXmlFragment > > INFO: No global web.xml found > > > > It does not look like the connector I created is actually being started. > When I try browsing to the above port using Chrome/IE all it does not > connect. > > > > I thought I was following the correct process base don information I > located on Google, however, it would appear I am still doing something > incorrect. > > > > I have confirmed the existence of the private key in the keystore (using > Keystore Explorer), so all that is fine. > > Please, any help would be greatly appreciated.
You may want to check how Embedded Tomcat is used in Tomcat's tests [1]. Regards Violeta [1] http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java