Jetty-Maven-Plugin читает jettyXml и по-прежнему запускает контекст по умолчанию

Я использую 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/}

Однако после этого плагин jetty-maven, кажется, пытается запустить контекст по умолчанию, который терпит неудачу с ненайденным классом. Он также пытается привязаться к «/», чего я явно не хочу.

WARN:oejs.Holder:java.lang.ClassNotFoundException: org.basex.http.rest.RESTServlet
INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/
INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/
INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/

Как я могу остановить запуск этого контекста? Любая помощь приветствуется.


person dirkk    schedule 26.07.2012    source источник


Ответы (2)


Согласно ответу в списке рассылки (http://dev.eclipse.org/mhonarc/lists/jetty-users/msg02419.html) Яна Бартеля, веб-приложение в настоящее время не может быть настроено исключительно с помощью jetty.xml.

Поэтому я решил проблему, переместив материалы, связанные с веб-приложением (базу ресурсов и контекстный путь), в maven pom.xml.

person dirkk    schedule 12.08.2012

Я использовал версию 8.1.4.v2012052 плагина jetty-maven и пытался установить contextPath в pom.xml примерно так:

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

Тем не менее, contextPath по-прежнему имеет значение «/».

Я откатился до версии 7.5.1.v20110908 с той же конфигурацией в pom.xml. Затем отображался предполагаемый contextPath.

Таким образом, я думаю, что это может быть проблема с версией 8.1.4, которая решается путем понижения версии.

person user482368    schedule 22.08.2012