0

いくつかの戦争を展開するために、jetty maven プラグインを使用しています。ポート 8180 の moduleA.war ポート 8380 の moduleB.war の 2 つのモジュールがあります。

maven jetty プラグインを使用して war を展開すると、両方のアプリケーションのコネクタを設定しているにもかかわらず、両方の webapps がポート 8180 で実行しようとしています。これを行うための私のpom構成は次のとおりです。

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>7.1.3.v20100526</version>
            <configuration>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>8180</port>
                        <name>instance_8180</name>                      
                    </connector>
                    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>8380</port>
                        <name>instance_8380</name>
                    </connector>
                </connectors>                   
                <contextHandlers>
                    <!-- <contextHandler implementation="org.mortbay.jetty.plugin.JettyWebAppContext"> -->
                    <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                        <war>/${project.build.directory}/user-mgmt-web-1.0-SNAPSHOT.war</war> 
                        <contextPath>/user-mgmt-web</contextPath>
                        <connectorNames>
                            <item>instance_8180</item>
                        </connectorNames>
                    </contextHandler>
                    <!-- <contextHandler implementation="org.mortbay.jetty.plugin.JettyWebAppContext"> -->
                    <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                        <war>/${project.build.directory}/services-web-1.0-SNAPSHOT.war</war> 
                        <contextPath>/services-web</contextPath>
                        <connectorNames>
                            <item>instance_8380</item>
                        </connectorNames>
                    </contextHandler>
                </contextHandlers>
                <stopPort>80</stopPort>
                <stopKey>stop</stopKey>
            </configuration>
            <executions>
                <execution>
                    <id>start-container</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                        <daemon>true</daemon>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-container</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

デプロイされた 2 番目の webapp を割り当てられたポートで開始する方法を知りたいです。それを実行すると、コンテナーが 2 番目の webapp の初期化を完了すると、アドレスが既に使用されているというエラーが表示されます。

あさね

4

1 に答える 1

0

2 つの異なるポートを持つ 2 つの異なるモジュールは、複数のインスタンスでのみ機能すると思います。あなたの場合、最初のポート番号のみがアクティブになり、最初のポートのアイドル タイムアウトを設定します。

<port>8180</port>
<maxIdleTime>"put your time"</maxIdleTime>

次に、別のポートを開始します。

上記が機能しない場合は、以下を試してください

jetty.xml に新しいコネクタを追加します

<!-- original connector on port 8080 -->
<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host"><Property name="jetty.host" /></Set>
        <Set name="port"><Property name="jetty.port" default="8080"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
    <Set name="lowResourcesConnections">20000</Set>
    <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>

<!-- new connector on port 8081 --> 
<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host"><Property name="jetty.host" /></Set>
        <Set name="port"><Property name="jetty.port" default="8081"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="statsOn">false</Set>
    <Set name="lowResourcesConnections">20000</Set>
    <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>
于 2012-05-22T05:48:23.347 に答える