gpt4 book ai didi

xml - Spring 配置文件给出 BeanDefinitionStoreException

转载 作者:数据小太阳 更新时间:2023-10-29 02:38:08 25 4
gpt4 key购买 nike

我正在努力完成 Spring MVC 教程: http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html

我的问题与这个类似 Spring configuration error

然而,这些解决方案似乎都不相关。

我得到以下堆栈跟踪:

org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from resource [/WEB-INF/springapp-servlet.xml] of ServletContext is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:133) org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:125) org.springframework.context.support.AbstractXmlApplicationContext.refreshBeanFactory(AbstractXmlApplicationContext.java:65) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:226) org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:281) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:229) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:199) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:102) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:883) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:722) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2214) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source)

我将其作为我的 springapp-servlet.xml 文件。

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!-- the application context definition for the springapp DispatcherServlet -->

<bean name="/hello.htm" class="springapp.web.HelloController"/>

</beans>

最佳答案

您的类路径中可能有一些旧的 spring jar 文件。

另见 forum post .

关于xml - Spring 配置文件给出 BeanDefinitionStoreException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1781663/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com