请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

测试404,但是数据库中有数据,我把图贴上来,麻烦老师看一看

第一次接触java项目。。所以有些问题还望老师海涵。Tomcat版本用的http://learning.happymmall.com/里面的,mysql5.7版本的。

//img1.sycdn.imooc.com//szimg/5b01b3d50001a56910840754.jpg

//img1.sycdn.imooc.com//szimg/5b01b3d80001f51e25591215.jpg

//img1.sycdn.imooc.com//szimg/5b01b3d8000100fb21431030.jpg


正在回答 回答被采纳积分+3

4回答

提问者 SuccessorSocialism 2018-05-22 23:49:03

老师问题解决了,webapp/WEB-INF中没有dispatcher-servlet.xml,并且dispatcher-servlet.xml里面的配置被我改错了.


0 回复 有任何疑惑可以回复我~
  • Geely #1
    好的,亲爱的同学,找到问题就好,不好意思回复晚了啊。
    回复 有任何疑惑可以回复我~ 2018-05-31 18:44:05
提问者 SuccessorSocialism 2018-05-22 00:39:35
#把mmall.war的文件放到tomcat的ROOT文件夹后,测试接口报500错误,错误信息如下.
五月 22, 2018 12:36:34 上午 org.springframework.web.servlet.FrameworkServlet initServletBean
信息: FrameworkServlet 'dispatcher': initialization started
五月 22, 2018 12:36:34 上午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue May 22 00:36:34 CST 2018]; parent: Root WebApplicationContext
五月 22, 2018 12:36:34 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
五月 22, 2018 12:36:34 上午 org.springframework.web.servlet.FrameworkServlet initServletBean
严重: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:343)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
	at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:643)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:606)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:657)
	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:525)
	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:466)
	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
	at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:853)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
	at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329)
	... 34 more


0 回复 有任何疑惑可以回复我~
提问者 SuccessorSocialism 2018-05-21 19:04:18
Context initialization failed  
上下文初始化失败,错误原因应该是这个吧,不过如何解决啊,百度了半天


0 回复 有任何疑惑可以回复我~
polo哦 2018-05-21 09:14:02

这个只是你日之框架报错了,你试试debug下你的测试接口,看看到哪一步报错了

0 回复 有任何疑惑可以回复我~
  • 提问者 SuccessorSocialism #1
    debug了,
    [2018-05-21 12:42:57,575] Artifact mmall:war: Artifact is deployed successfully
    [2018-05-21 12:42:57,575] Artifact mmall:war: Deploy took 2,723 milliseconds
    五月 21, 2018 12:43:04 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory /usr/local/src/apache-tomcat-7.0.73/webapps/manager
    五月 21, 2018 12:43:04 下午 org.apache.catalina.startup.TldConfig execute
    信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    五月 21, 2018 12:43:04 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory /usr/local/src/apache-tomcat-7.0.73/webapps/manager has finished in 193 ms
    这是测试返回404后,idea返回的信息
    回复 有任何疑惑可以回复我~ 2018-05-21 12:44:33
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信