mvn-jetty:运行时出现错误404



我有一个Spring MVC web应用程序,并尝试使用Jetty运行它。但是每当我输入

mvn码头:运行

我得到了以"Jetty Server Started"结尾的正确事件序列

但是,当我尝试打开浏览器并键入时

http:localhost:8080/app

我得到错误404页面未找到

这是我的pom.xml码头部分

<plugin>
  <!-- This plugin is needed for the servlet example -->
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.2.0.v20101020</version>
  <configuration>
    <webApp>
      <contextPath>/app</contextPath>
    </webApp>
  </configuration>
</plugin>

我的控制器被映射到@RequestMapping("/"),我的servlet也被映射到/。pom.xml构建名称为app,因此URL为http://localhost:8080/app

任何帮助都将是伟大的。我也尝试过Jetty v9,但它也不起作用

试试这个,它工作得很好

编辑

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.8</version>
       <configuration>
          <contextPath>/app</contextPath>
       </configuration>
</plugin>

首先http:localhost:8080/app是错误的,它应该是http://localhost:8080/app。如果你给出这个url,那么你必须有一个可以在web.xml中指定的登录页像这个

<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

因此,只需尝试访问url http://localhost:8080/app/index.jsp,其中web内容文件夹

下必须有一些index.jsp

相关内容

最新更新