Jetty-Maven-Plugin은 jettyxml을 읽고 여전히 기본 컨텍스트를 시작합니다.

StackOverflow https://stackoverflow.com//questions/11664682

  •  11-12-2019
  •  | 
  •  

문제

Jetty 8.1.4.v20120524 및 Maven 3. 나는 내 POM에서 다음과 같은 구성을 가지고있다 :

  <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.4.v20120524</version>
    <configuration>
      <jettyXml>${project.basedir}/src/main/resources/jetty.xml</jettyXml>
    </configuration>
  </plugin>
.

내 jetty.xml에서는 컨텍스트 정의 :

<Set name="handler">
  <New class="org.eclipse.jetty.server.handler.HandlerList">
    <Set name="handlers">
      <Array type="org.eclipse.jetty.server.Handler">
        <Item>
          <New class="org.eclipse.jetty.server.handler.ResourceHandler">
            <Set name="welcomeFiles">
              <Array type="String"><Item>index.xml,index.xhtml,index.html</Item></Array>
            </Set>
          </New>
        </Item>
        <Item>
          <New id="Contexts" class="org.eclipse.jetty.webapp.WebAppContext">
            <Set name="resourceBase"><SystemProperty name="jetty.home" default="src/main/webapp" /></Set>
            <Set name="contextPath">/</Set>
          </New>
        </Item>
      </Array>
    </Set>
  </New>
</Set>
.

이것은 예상대로 작동하며 / : 에서 내 응용 프로그램을 시작합니다.

INFO:oejs.Server:jetty-8.1.4.v20120524
INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/}
INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/}
.

그러나이 후에,이 후에, 클래스가없는 클래스와 실패한 기본 컨텍스트를 시작하려고하는 것으로 보인다 - 명백하게 원하지 않는 "/"에 바인딩하려고합니다. 이 컨텍스트를 시작할 수있는 방법은 무엇입니까?어떤 도움이 크게 감사드립니다.

도움이 되었습니까?

해결책

메일 링리스트에 대한 답변 (http://dev.eclipse.org/mhonarc/lists/jetty-users/msg02419.html)에 의해 Jan Bartel의 웹 앱은 현재 Jetty와 함께만으로 구성 할 수 없습니다.XML.

웹 앱 관련 재료 (자원 기본 및 컨텍스트 경로)를 maven pom.xml로 이동하여 문제를 해결했습니다.

다른 팁

Jetty-Maven-Plugin의 버전 8.1.4.v2012052를 사용하고 pom.xml에서 contextpath를 다음과 같이 설정하려고 시도했습니다.

<configuration>
<webAppConfig>
    <contextPath>${application.contextpath}</contextPath>
</webAppConfig> 
...
</configuration>
.

아직, ContextPath는 여전히 기본값으로 "/".로 설정되었습니다.

pom.xml에서 동일한 구성으로 버전 7.5.1.v20110908로 다운 그레이드되었습니다.의도 된 contextpath가 표시되었습니다.

이렇게하면 다운 그레이드로 해결 된 8.1.4 버전의 문제 일 수 있습니다.

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