相关疑难解决方法(0)

更改Jetty默认端口

Jetty默认端口是8080,但我想将默认端口更改为其他端口(9999).

我阅读了一些教程,他们说几乎所有的配置信息都默认保存在文件中jetty.xml,这个文件位于$JETTY_HOME/etc/.然后,将属性更改jetty.port为9999.但是,当我打开该文件时,我找不到其中的jetty.port属性jetty.xml.我目前正在使用Jetty-9.2.1,端口是8080.

我在jetty-http.xml文件下找到了jetty.port属性.即使我在jetty-http.xml文件中将端口更改为8090,Jetty仍然在端口8080上运行.

的jetty.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">

<!-- =============================================================== -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax        -->
<!--                                                                 -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
<!-- and can be mixed in. See start.ini file for the default         -->
<!-- configuration files.                                            -->
<!--                                                                 -->
<!-- For a description of the configuration mechanism, see the       -->
<!-- output of: …
Run Code Online (Sandbox Code Playgroud)

java jetty maven maven-jetty-plugin

21
推荐指数
4
解决办法
7万
查看次数

java keytool给出"最后一块没有正确填充"

按照本Jetty指南的步骤3b,使用Keytool和OpenSSL,最后一步,我正在执行命令:

keytool -importkeystore -srckeystore jetty.pkcs12 -srcstoretype PKCS12 -destkeystore keystore
Run Code Online (Sandbox Code Playgroud)

当我运行命令时,我得到: keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded

你知道怎么解决这个问题吗?

java ssl-certificate

8
推荐指数
2
解决办法
3万
查看次数

Maven的jetty插件SSL配置问题

我正在使用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>
Run Code Online (Sandbox Code Playgroud)

试图用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
Run Code Online (Sandbox Code Playgroud)

使用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 /码头-分布- 7.0.0.pre5现场组分/目标/站点/ apidocs /组织/ mortbay /码头/ 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 /码头 - 分布 - 7.0.0.pre5现场组分/目标/站点/ apidocs /组织/ mortbay …

maven-2 jetty maven-plugin

6
推荐指数
2
解决办法
1万
查看次数

使用Jetty和JavaScript客户端设置安全的WebSocket服务器

我正在尝试使用Jetty设置安全的WebSocket服务器,如下所示:

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.websocket.server.WebSocketHandler;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;


public class WebSocketServer
{
    private Server server;
    private String host="localhost";
    private int port=8080;
    private String keyStorePath = "C:\\keystore";
    private String keyStorePassword="password";
    private String keyManagerPassword="password";
    private List<Handler> webSocketHandlerList = new ArrayList();
    MessageHandler messagehandler;

    public WebSocketServer()
    {
        System.out.println("WebSocketServer");

        server = new Server();

        // connector configuration
        SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStorePath(keyStorePath);
        sslContextFactory.setKeyStorePassword(keyStorePassword);
        sslContextFactory.setKeyManagerPassword(keyManagerPassword); …
Run Code Online (Sandbox Code Playgroud)

javascript java ssl websocket

2
推荐指数
1
解决办法
5947
查看次数