[英]mvn jetty:run giving error 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
,那么您必須具有可以在web.xml中指定的登錄頁面,就像這樣
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
因此,只需嘗試訪問URL http://localhost:8080/app/index.jsp
,其中Web-content文件夾下必須有一些index.jsp
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.