Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven's jetty plugin SSL configuration issue

I'm using Jetty's plugin for Maven, version 7.0.0.pre5, but I have issues configuring it to have a SSL Connector. Whenever I start the application, it fails stating that the requested implementation is not found.

This is the plugin's configuration within my pom.xml

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.0.0.pre5</version>
  <configuration>
    <connectors>
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.mortbay.jetty.ssl.SslSelectChannelConnector">
        <port>8443</port>
        <keystore>src/test/resources/server.keystore</keystore>
        <keyPassword>123456</keyPassword>
        <password>123456</password>
      </connector>
    </connectors>
  </configuration>
</plugin>

Attempting to run it with mvn jetty:run gives the following output:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.mortbay.jetty:jetty-maven-plugin:7.0.0.pre5



Cause: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.mortbay.jetty.ssl.SslSelectChannelConnector' cannot be loaded

Using org.mortbay.jetty.ssl.SslSocketConnector renders the same result.

It's really weird, since, according to Jetty's own documentation, both classes exists and that's their correct name (notice in Jetty 6 the package security was used instead of ssl).

Reference: http://www.jarvana.com/jarvana/view/org/mortbay/jetty/jetty-assembly/7.0.0.pre5/jetty-assembly-7.0.0.pre5-site-component.jar!/jetty-7.0.0.pre5/jetty-distribution-7.0.0.pre5-site-component/target/site/apidocs/org/mortbay/jetty/ssl/SslSocketConnector.html

http://www.jarvana.com/jarvana/view/org/mortbay/jetty/jetty-assembly/7.0.0.pre5/jetty-assembly-7.0.0.pre5-site-component.jar!/jetty-7.0.0.pre5/jetty-distribution-7.0.0.pre5-site-component/target/site/apidocs/org/mortbay/jetty/ssl/SslSelectChannelConnector.html

Any ideas are welcome.

like image 924
Johnco Avatar asked Feb 07 '10 01:02

Johnco


3 Answers

For the current version of jetty-maven-plugin, 8.0.0.M2, the class names have been moved into org.eclipse.*, and no additional dependencies are needed.

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.0.0.M2</version>
    <configuration>
        <webAppConfig>
            <contextPath>/</contextPath>
        </webAppConfig>
        <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <port>8080</port>
            </connector>
            <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
                <port>8443</port>
                <keystore>src/test/resources/server.keystore</keystore>
                <keyPassword>123456</keyPassword>
                <password>123456</password>
            </connector>
        </connectors>
    </configuration>
</plugin>

See: http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7

like image 57
Greg Chabala Avatar answered Oct 26 '22 12:10

Greg Chabala


Not sure this is normal but the jetty-maven-plugin doesn't have jetty-ssl as dependency in its pom. So please update your pom like this:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.0.0.pre5</version>
  <configuration>
    <connectors>
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.mortbay.jetty.ssl.SslSelectChannelConnector">
        <port>8443</port>
        <keystore>src/test/resources/server.keystore</keystore>
        <keyPassword>123456</keyPassword>
        <password>123456</password>
      </connector>
    </connectors>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-ssl</artifactId>
      <version>7.0.0.pre5</version>
    </dependency>
  </dependencies>
</plugin>

And the plugin will succeed to load org.mortbay.jetty.ssl.SslSelectChannelConnector.

like image 20
Pascal Thivent Avatar answered Oct 26 '22 11:10

Pascal Thivent


For anyone using Jetty 6.x, the artifact to include in the dependencies for the plugin is jetty-sslengine.

like image 25
gnuf Avatar answered Oct 26 '22 12:10

gnuf