4

Eclipse Jetty Maven プラグイン (9.1.0.M0) を介して組み込みの Jetty を使用しています。

に次のプラグイン構成がありますpom.xml

                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>${version.jetty}</version>

                    <configuration>
                        <scanIntervalSeconds>10</scanIntervalSeconds>
                        <daemon>true</daemon>

                        <webApp>
                            <contextPath>/</contextPath>
                            <descriptor>${basedir}/src/test/webapp/WEB-INF/web.xml</descriptor>
                        </webApp>

                        <httpConnector>
                            <port>48080</port>
                        </httpConnector>

                        <stopPort>19081</stopPort>
                        <stopKey>53AS9DS1FD8E3WEFEW9GR1ER8G2ER0WE31</stopKey>
                    </configuration>

                    <executions>
                        <execution>
                            <id>jetty-start</id>

                            <phase>test-compile</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>jetty-stop</id>

                            <phase>test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

Jetty がシャットダウンしているときに、次の例外が発生し続けます。

2013-09-27 04:51:08.309:WARN:oejuc.AbstractLifeCycle:Thread-68: FAILED WebSocketClient@873794597{FAILED,8<=8<=200,i=8,q=0}: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/QueuedThreadPool$1
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/QueuedThreadPool$1
    at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:121)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:129)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:148)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:133)
Caused by: 
java.lang.ClassNotFoundException: org.eclipse.jetty.util.thread.QueuedThreadPool$1
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:121)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:129)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:148)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:133)
2013-09-27 04:51:08.310:WARN:oejuc.AbstractLifeCycle:Thread-68: FAILED org.eclipse.jetty.websocket.client.WebSocketClient@34150c25: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/QueuedThreadPool$1
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/QueuedThreadPool$1
    at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:121)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:129)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:148)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:133)
Caused by: 
java.lang.ClassNotFoundException: org.eclipse.jetty.util.thread.QueuedThreadPool$1
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:121)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:129)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:148)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:133)
Exception in thread "Thread-68" java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/QueuedThreadPool$1
    at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:121)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:129)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:148)
    at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)
    at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:133)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.thread.QueuedThreadPool$1
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 7 more

プラグインの依存関係として追加しようとしjetty-utilました(そして、プロジェクトも)。これは役に立たず、私を怒らせています。ビルドは実際に成功していますが、Maven ビルドの最後に Jetty がシャットダウンしているときにこれらのエラーが表示されるのは本当に耐えられません。

お知らせ下さい!よろしくお願いします!

4

6 に答える 6

2

<stopWait>10</stopWait>プラグイン構成に追加してみてください。

完全な構成:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.1.4.v20140401</version>

    <configuration>
        <stopPort>8005</stopPort>
        <stopKey>STOP</stopKey>
        <stopWait>10</stopWait>
    </configuration>

    <executions>
        <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <daemon>true</daemon>
            </configuration>
        </execution>

        <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
</plugin>
于 2014-04-16T06:52:26.537 に答える
2

9.0.5.v20130815現在使用しているマイルストーン (まだ開発中) の代わりに、リリース バージョンを使用することをお勧めします。9.1.0.M0

于 2013-09-27T07:37:45.163 に答える
1

「検証」フェーズで統合テストを実行すると、maven-jetty-plugin バージョン 8.1.14.v20131031 で同じ問題が発生しました。

2 つの依存関係が必要でした (maven-jetty-plugin の正確なバージョンに注意してください)。

    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-jsp</artifactId>
        <version>8.1.14.v20131031</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-util</artifactId>
        <version>8.1.14.v20131031</version>
    </dependency>

最後に、この maven-jetty-plugin 構成を使用しました。

<plugin>
<!-- jetty-maven-plugin must be outside pluginManagement, otherwise it does not run properly during 'verify' -->
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.14.v20131031</version>
    <configuration>
        <stopPort>9966</stopPort>
        <stopKey>PARENT</stopKey>
    </configuration>
    <executions>
        <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <daemon>true</daemon>
            </configuration>
        </execution>
        <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
</plugin>

実際の「jetty-maven-plugin:8.1.14.v20131031:stop (stop-jetty)」フェーズ中に、プラグイン自体によって報告されたいくつかのエラー (つまり、stopPort と stopKey の欠落に関する苦情) がありました。

java.lang.ClassNotFoundException: org.eclipse.jetty.util.thread.QueuedThreadPool$1

于 2013-12-11T09:20:39.873 に答える
1

この答えを見つける前に、私はこれに苦労しなければなりませんでした: https://stackoverflow.com/a/22856563/529286。基本的には、Risto Oikarinen が言うように機能します。さらに、次のように機能します。 ' フェーズでは、Jetty を正しく停止させるために、'verify' または 'install' (またはそれ以降の目標) を呼び出す必要があります。

于 2014-04-04T07:45:29.083 に答える
0

ドキュメントに構成を追加して解決しました: http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-stop-goal

       <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.1.4.v20140401</version>
            <configuration>
                <contextPath>/</contextPath>
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <stopPort>9966</stopPort>
                <stopKey>foo</stopKey>
                <stopWait>10</stopWait>
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <daemon>true</daemon>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
于 2014-04-10T12:40:42.447 に答える