Maven的jetty插件SSL配置问题

发布于 2024-08-20 08:18:06 字数 2706 浏览 4 评论 0原文

我正在使用 Jetty 的 Maven 插件,版本 7.0.0.pre5,但在将其配置为具有 SSL 连接器时遇到问题。每当我启动应用程序时,它都会失败,指出未找到请求的实现。

这是我的 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>

尝试使用 mvn jetty:run 运行它会给出以下输出:

[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

使用 org.mortbay.jetty.ssl.SslSocketConnector 呈现相同的结果。

这真的很奇怪,因为根据 Jetty 自己的文档,这两个类都存在,并且这是它们的正确名称(请注意,在 Jetty 6 中使用了包安全性而不是 ssl)。

参考: 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

欢迎任何想法。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

得不到的就毁灭 2024-08-27 08:18:06

对于当前版本的 jetty-maven-plugin 8.0.0.M2,类名已移至 org.eclipse.* 中,并且不需要额外的依赖项。

<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>

请参阅:http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7

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

各自安好 2024-08-27 08:18:06

不确定这是否正常,但 jetty-maven-plugin 在其 pom.xml 中没有 jetty-ssl 作为依赖项。因此,请像这样更新你的pom:

<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>

插件将成功加载org.mortbay.jetty.ssl.SslSelectChannelConnector

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.

情痴 2024-08-27 08:18:06

对于使用 Jetty 6.x 的任何人来说,要包含在插件依赖项中的工件是jetty-sslengine。

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

慵挽 2024-08-27 08:18:06

实际上与 Pascal Thivent 的回答相同,并结合了 gnuf 答案,但有效(版本 6.1.26)。

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>6.1.26</version>
  <configuration>
    <connectors>
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.mortbay.jetty.security.SslSelectChannelConnector">
        <port>8443</port>
        <keystore>server.keystore</keystore>
        <keyPassword>password</keyPassword>
      </connector>
    </connectors>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-sslengine</artifactId>
      <version>6.1.26</version>
    </dependency>
  </dependencies>
</plugin>

Actually same as answered by Pascal Thivent with conjunction of an gnuf answer but valid one (ver. 6.1.26).

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>6.1.26</version>
  <configuration>
    <connectors>
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.mortbay.jetty.security.SslSelectChannelConnector">
        <port>8443</port>
        <keystore>server.keystore</keystore>
        <keyPassword>password</keyPassword>
      </connector>
    </connectors>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-sslengine</artifactId>
      <version>6.1.26</version>
    </dependency>
  </dependencies>
</plugin>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文