title: Serving as HTTPS Sonatype Nexus
body: <p>I have installed nexus as a cluster which consist of 3 windows nodes. Right now I want to serve Nexus as HTTPS. When I followed <a href="https://help.sonatype.com/repomanager3/security/configuring-ssl#ConfiguringSSL-ServingSSLDirectly" rel="nofollow noreferrer">this documentation</a>, I did everything as suggested but when I run the command</p>
  
  <pre><code>nexus.exe /run 
  </code></pre>
  
  <p>I'm getting an error that says </p>
  
  <pre><code>java.lang.IllegalStateException: no valid keystore
          at org.eclipse.jetty.util.security.CertificateUtils.getKeyStore(CertificateUtils.java:50)
          at org.eclipse.jetty.util.ssl.SslContextFactory.loadKeyStore(SslContextFactory.java:1194)
          at org.eclipse.jetty.util.ssl.SslContextFactory.load(SslContextFactory.java:334)
          at org.eclipse.jetty.util.ssl.SslContextFactory.doStart(SslContextFactory.java:256)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
          at org.eclipse.jetty.server.SslConnectionFactory.doStart(SslConnectionFactory.java:94)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
          at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
          at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:282)
          at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:81)
          at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
          at org.eclipse.jetty.server.Server.doStart(Server.java:396)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
          at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:274)
  </code></pre>
  
  <p>My jetty-https.xml config file is like below,</p>
  
  <pre><code>...
  &lt;New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"&gt;
      &lt;Set name="certAlias"&gt;my-wildcard-cert&lt;/Set&gt;
      &lt;Set name="KeyStorePath"&gt;&lt;Property name="ssl.etc"/&gt;/keystore.jks&lt;/Set&gt;
      &lt;Set name="KeyStorePassword"&gt;changeit&lt;/Set&gt;
      &lt;Set name="KeyManagerPassword"&gt;changeit&lt;/Set&gt;
      &lt;Set name="TrustStorePath"&gt;&lt;Property name="ssl.etc"/&gt;/keystore.jks&lt;/Set&gt;
      &lt;Set name="TrustStorePassword"&gt;changeit&lt;/Set&gt;
      &lt;Set name="EndpointIdentificationAlgorithm"&gt;&lt;/Set&gt;
      &lt;Set name="NeedClientAuth"&gt;&lt;Property name="jetty.ssl.needClientAuth" default="false"/&gt;&lt;/Set&gt;
      &lt;Set name="WantClientAuth"&gt;&lt;Property name="jetty.ssl.wantClientAuth" default="false"/&gt;&lt;/Set&gt;
      &lt;Set name="ExcludeCipherSuites"&gt;
        &lt;Array type="String"&gt;
          &lt;Item&gt;SSL_RSA_WITH_DES_CBC_SHA&lt;/Item&gt;
          &lt;Item&gt;SSL_DHE_RSA_WITH_DES_CBC_SHA&lt;/Item&gt;
          &lt;Item&gt;SSL_DHE_DSS_WITH_DES_CBC_SHA&lt;/Item&gt;
          &lt;Item&gt;SSL_RSA_EXPORT_WITH_RC4_40_MD5&lt;/Item&gt;
          &lt;Item&gt;SSL_RSA_EXPORT_WITH_DES40_CBC_SHA&lt;/Item&gt;
          &lt;Item&gt;SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA&lt;/Item&gt;
          &lt;Item&gt;SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA&lt;/Item&gt;
        &lt;/Array&gt;
      &lt;/Set&gt;
    &lt;/New&gt;
  ...
  </code></pre>
  
  <p>I believe my problem with keystore file location but I tried so much and couldn't get any successful result.</p>
  
  <p>I tried like, <code>&lt;Set name="KeyStorePath"&gt;&lt;Property
     name="ssl.etc"/&gt;C:\users\&lt;myusername&gt;\keystore.jks&lt;/Set&gt;</code> and that caused to change error message:  </p>
  
  <pre><code>2020-03-13 12:40:56,904+0300 ERROR [FelixDispatchQueue] *SYSTEM org.sonatype.nexus.bootstrap - FrameworkEvent ERROR - org.sonatype.nexus.bootstrap
  org.osgi.framework.BundleException: Activator start error in bundle org.sonatype.nexus.bootstrap [65].
          at org.apache.felix.framework.Felix.activateBundle(Felix.java:2290)
          at org.apache.felix.framework.Felix.startBundle(Felix.java:2146)
          at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373)
          at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.reflect.InvocationTargetException: null
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:545)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:466)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:875)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:478)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:413)
          at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:311)
          at org.sonatype.nexus.bootstrap.jetty.JettyServer.doStart(JettyServer.java:168)
          at org.sonatype.nexus.bootstrap.jetty.JettyServer.lambda$0(JettyServer.java:117)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.sonatype.nexus.bootstrap.jetty.JettyServer.start(JettyServer.java:115)
          at org.sonatype.nexus.bootstrap.Launcher.start(Launcher.java:131)
          at org.sonatype.nexus.bootstrap.Launcher.startAsync(Launcher.java:127)
          at org.sonatype.nexus.bootstrap.osgi.LauncherActivator.start(LauncherActivator.java:67)
          at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
          at org.apache.felix.framework.Felix.activateBundle(Felix.java:2240)
          ... 4 common frames omitted
  Caused by: java.lang.IllegalArgumentException: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
          at org.eclipse.jetty.util.ssl.SslContextFactory.setKeyStorePath(SslContextFactory.java:656)
          ... 23 common frames omitted
  Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
          at java.io.WinNTFileSystem.canonicalize0(Native Method)
          at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
          at java.io.File.getCanonicalPath(File.java:618)
          at java.io.File.getCanonicalFile(File.java:643)
          at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:184)
          at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:154)
          at org.eclipse.jetty.util.ssl.SslContextFactory.setKeyStorePath(SslContextFactory.java:652)
          ... 23 common frames omitted
          Suppressed: java.net.MalformedURLException: Unknown protocol: c
                  at java.net.URL.&lt;init&gt;(URL.java:627)
                  at java.net.URL.&lt;init&gt;(URL.java:490)
                  at java.net.URL.&lt;init&gt;(URL.java:439)
                  at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:171)
                  ... 25 common frames omitted
          Caused by: java.lang.IllegalStateException: Unknown protocol: c
                  at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)
                  at java.net.URL.&lt;init&gt;(URL.java:622)
                  ... 28 common frames omitted
  </code></pre>
  
  <p>When I searched for <strong>Unknown protocol: c</strong> <a href="https://stackoverflow.com/questions/8474694/java-url-unknown-protocol-c/8474725">here</a> it's suggested to use as <strong>file:///C:/Users/MyUser/image.jpg</strong> I tried that too but still got unknown protocol: c error.</p>
  
  <p>How should I fix my jetty-https.xml file? </p>
  
  <p>Thanks in advance<br>
  Best Regards</p>