http://localhost:8080/hello/mvc 報(bào)404錯(cuò)誤
C:\workspacej2ee\weishop>mvn jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building weishop Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.2.2.v20140723:run (default-cli) > test-compile @ weishop >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ weishop ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ weishop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ weishop ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\workspacej2ee\weishop\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ weishop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< jetty-maven-plugin:9.2.2.v20140723:run (default-cli) < test-compile @ weishop <<<
[INFO]
[INFO] --- jetty-maven-plugin:9.2.2.v20140723:run (default-cli) @ weishop ---
[INFO] Logging initialized @3515ms
[INFO] Configuring Jetty for project: weishop Maven Webapp
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = C:\workspacej2ee\weishop\target\classes
[INFO] Context path = /
[INFO] Tmp directory = C:\workspacej2ee\weishop\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = ?none
[INFO] web.xml file = file:/C:/workspacej2ee/weishop/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = C:\workspacej2ee\weishop\src\main\webapp
[INFO] jetty-9.2.2.v20140723
[INFO] No Spring WebApplicationInitializer types detected on classpath
[INFO] Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[INFO] Initializing Spring FrameworkServlet 'mvc-dispatcher'
[INFO] Started o.e.j.m.p.JettyWebAppContext@79a1728c{/,file:/C:/workspacej2ee/weishop/src/main/webapp/,AVAILABLE}{file:/C:/workspacej2ee/weishop/src/main/webapp/}
[WARNING] !RequestLog
[INFO] Started ServerConnector@1a015bc0{HTTP/1.1}{0.0.0.0:8080}
[INFO] Started @7351ms
[INFO] Started Jetty Server
2017-09-25
是可以的:(tomcat做server時(shí),要加上項(xiàng)目名稱):
http://localhost:8080/spring-mvc-study/hello/mvc? 運(yùn)行后報(bào)503錯(cuò)誤,發(fā)現(xiàn)沒有導(dǎo)入jstl的jar包,導(dǎo)入pom的坐標(biāo):
<dependency>?
<groupId>javax.servlet</groupId>?
<artifactId>jstl</artifactId>?
<version>1.2</version>?
</dependency>
完成:
2017-05-11
大哥,你的問題解決了嗎,我跟你一樣的問題,我用的tomcat運(yùn)行的,訪問http://localhost:8080/ZLearnSpringMvc/hello/mvc就報(bào)錯(cuò),ZLearnSpringMvc是我的項(xiàng)目名,求解答啊。。
2016-11-21
這個(gè)問題我已經(jīng)完全解決了,之間還遇到許多問題。
聽我說可能的原因,首先這個(gè) jetty的啟動沒什么問題,它已經(jīng)啟動了,然后由于是jetty做的web容器,所以你訪問的應(yīng)該是 ?http://localhost:8080/hello/mvc?, 但是出現(xiàn)報(bào)錯(cuò),看不出原因,因此我建議把jetty停掉,改為tomcat啟動(用tomcat可以快速定位原因),此時(shí)先看它控制臺有沒有異常輸出,然后tomcat 訪問地址應(yīng)該是:?http://localhost:8080/你的項(xiàng)目名/hello/mvc? ,再看 異常輸出,之后就是對這些異常依個(gè)排除就行了。
等到tomcat可以正常訪問,那換成jetty也可以訪問了。
ps:順便說一下我遇到的問題,
第一個(gè)問題是 ?java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 。。。
? ?解決方法:**工程名上右擊 -> Properties -> Deployment Assembly,
Add -> Java Build Path Entries -> next -> 選擇maven Dependencies**
第二個(gè)問題是 jstl not found?
解決方法:在pom.xml里 加入:
<dependency>?
<groupId>javax.servlet</groupId>?
<artifactId>jstl</artifactId>?
<version>1.2</version>?
</dependency>
2016-10-29
http://localhost:8080/spring-mvc-study/hello/mvc這個(gè)也不行
2016-09-06
我不知道老師是怎么運(yùn)行出來的,我用的myeclipse中的tomcat,應(yīng)該輸入http://localhost:8080/項(xiàng)目名/hello/mvc,才能正常顯示
2016-09-05
你的項(xiàng)目名叫weishop吧,你訪問
http://localhost:8080/weishop/mvc才可以吧