Невозможно открыть httpConnection в Jetty9 при миграции с jetty6 - PullRequest
0 голосов
/ 03 октября 2019

Я перевожу свой текущий Java-проект на базе Spring из Jetty6 в Jetty9. Я также мигрирую с JDK6 на JDK9 одновременно. Я понимаю, что с причалом многое изменилось. Я пытался проследовать по ссылке с документа с пристани, но после успешного создания моего проекта я получаю сообщение об ошибке при попытке открыть активные соединения http / https.

Я выполнил настройку в XML, так как я читаю много значенийиз файла свойств и выполнение всего этого программно не будет очень чистым подходом.

Ниже приведена моя конфигурация: -

<Configure id="server" class="org.eclipse.jetty.server.Server">
<New id="httpConfig"
        class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort"><Ref id="opPort" /></Set>
        <Set name="outputBufferSize">32768</Set>
        <Set name="requestHeaderSize">8192</Set>
        <Set name="responseHeaderSize">8192</Set>
        <Set name="sendServerVersion">true</Set>
        <Set name="sendDateHeader">false</Set>
        <Set name="headerCacheSize">512</Set>
        <Call name="addCustomizer">
            <Arg>
                <New class="org.eclipse.jetty.server.SecureRequestCustomizer" />
            </Arg>
        </Call>
    </New>
<Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server">
                    <Ref refid="server" />
                </Arg>
<!--                <Arg name="acceptors">2</Arg> -->
<!--                <Arg name="selectors">-1</Arg> -->
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <Item>
                            <New class="org.eclipse.jetty.server.SslConnectionFactory">
                                <Arg name="next">http/1.1</Arg>
                                <Arg name="sslContextFactory">
                                    <Ref refid="sslContextFactory" />
                                </Arg>
                            </New>
                        </Item>
                        <Item>
                            <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                                <Arg name="config">
                                    <Ref refid="httpConfig" />
                                </Arg>
                            </New>
                        </Item>
                    </Array>
                </Arg>
                <Set name="host">localhost</Set>
                <Set name="port">
                    <Ref id="opPort" />
                </Set>
                <Set name="idleTimeout">2000000</Set>
                <Set name="acceptQueueSize">64</Set>
            </New>
        </Arg>
    </Call>
<New id="sslContextFactory"
        class="org.eclipse.jetty.util.ssl.SslContextFactory">
        <Set name="keyStorePath">./configuration/dev/keystore</Set>
        <Set name="keyStorePassword">OBF:1zlu1uum1toq1w8v1to41uvk1zlo</Set>
        <Set name="keyManagerPassword">OBF:1zlu1uum1toq1w8v1to41uvk1zlo</Set>
        <Set name="trustStorePath">./configuration/dev/keystore</Set>
        <Set name="trustStorePassword">OBF:1zlu1uum1toq1w8v1to41uvk1zlo</Set>
<!--        <Set name="endpointIdentificationAlgorithm"></Set> -->
        <Set name="ExcludeCipherSuites">
            <Array type="String">
                <Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
                <Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
                <Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
                <Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
                <Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
                <Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
                <Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
            </Array>
        </Set>
    </New>
<Set name="handler">
        <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
            <Set name="handlers">
                <Array type="org.eclipse.jetty.server.Handler">
                    <!--your web app WAR goes here -->
                    <Item>
                        <New id="WmSecurityWebApp" class="org.eclipse.jetty.webapp.WebAppContext">
                            <Arg>./target/gls-op.war</Arg>
                            <Arg>/gls-op/us/7049</Arg>
                            <Set name="logUrlOnStart"  type="boolean">true</Set>
<Set name="parentLoaderPriority">true</Set>
</New>
                    </Item>
</Array>
            </Set>
        </New>
    </Set>

Пока проект строится успешно, но когда я нажимаю на любой Rest APIвыдает ошибку: -

16:26:16.470 [qtp985922955-32] DEBUG o.e.j.util.thread.QueuedThreadPool - ran EatWhatYouKill@29855e88/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@dcd6f19/PRODUCING/1/1
16:26:16.470 [qtp985922955-18] DEBUG o.e.jetty.server.HttpConnection -
javax.net.ssl.SSLHandshakeException: Unrecognized SSL message, plaintext connection?
   at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:804) ~[jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]

Я обновил хранилище ключей, используя jdk8, а также форму OBF, используя версию утилиты Jetty, используемую на моей машине.

Даже после многих изменений,это не работает для меня.

1 Ответ

0 голосов
/ 04 октября 2019

Я удалил SSL и протестировал только с использованием настроек HTTP-соединения. Работало нормально. Сейчас я не использую SSL, и сейчас это хорошо. Тем временем я буду проверять варианты использования обеих настроек в одном файле.

...