문제

maven-jetty-plugin을 사용하고 jetty.xml 설정을 -djetty.port= 8090으로 무시하려고하지만 작동하지 않습니다.jetty.xml 파일에서 커넥터 부분을 제거 할 때만 포트를 8090으로 얻을 수 있습니다.

그래서 :

 mvn jetty:run -Djetty.port=8090
.

커넥터가 포트 8080 에서 시작됩니다.

포트 8090 에서 커넥터가 시작되지 않음

문제는 수용자, 통계 및 기타 물건을 구성해야합니다.커넥터에서 포트 만 제거했지만 작동하지 않았습니다.

사용 중입니다 :

JAVA 1.7_05
MAVEN 3.0.4
Jetty 8.1.4
Linux Ubuntu 12.04 64bits
.

여기에 내 pom.xml 플러그인 구성 :

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.4.v20120524</version>
            <configuration>
                <stopKey>foo</stopKey>
                <stopPort>9990</stopPort>
                <jettyXml>src/main/webapp/WEB-INF/jetty.xml</jettyXml>
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <!-- <phase>pre-integration-test</phase> -->
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <!-- <phase>post-integration-test</phase> -->
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
</plugin>
.

jetty.xml 커넥터 conf :

<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">4</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
    <Set name="lowResourcesConnections">20000</Set>
    <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>
.

미리 감사드립니다!

업데이트 1 : 또한 jetty.xml의 속성 대신 SystemProperty를 사용하여 시도했습니다.가되지 않았습니다

도움이 되었습니까?

해결책

업데이트 1 : 작업이 일했습니다.그 이유를 모르겠지만, 나는 호스트와 함께 SystemProperty와 그것이 일했습니다.그런 다음 호스트를 제거하고 작업했습니다.

So Final Fix jetty.xml 커넥터 conf :

<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host"><SystemProperty name="jetty.host" /></Set>
        <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">4</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
    <Set name="lowResourcesConnections">20000</Set>
    <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>
.

다른 팁

나는 같은 문제가 있었다.FIX :

POM의 속성 섹션에서 jetty.port : 를 정의하십시오.

<properties>
    <jetty.port>8888</jetty.port>
            ....
</properties>
.

플러그인 구성 :

<connectors>
    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <maxIdleTime>3600000</maxIdleTime>
        <port>${jetty.port}</port>
    </connector>
.

이렇게하면 명령 행의 포트를 로 무시할 수 있습니다.

mvn -D jetty.port=9999 jetty:run
.

./jetty.sh start 명령을 사용하는 경우 서버를 시작하려면 Base 폴더에서 start.ini 또는 start.d에서 Configure를 읽어보십시오. 포트 (jetty.port)를 변경하고 서버를 다시 시작하십시오..

"포트"내에서 SystemProperty 마크 업을 제거하고 새 포트 값을 "포트"마크 업 내부에 넣으십시오.

여기에 이미지 설명

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top