2009-11-23 4 views
3

Je suis en train de terminer le tutoriel Spring MVC à: http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.htmlfichier de configuration Spring donne BeanDefinitionStoreException

Mon problème est similaire à celui-ci Spring configuration error

Cependant, aucune de ces solutions semblent pertinentes.

Je reçois la trace de la pile suivante:

org.springframework.beans.factory.BeanDefinitionStoreException: ligne 6 dans le document XML à partir des ressources [/WEB-INF/springapp-servlet.xml] de ServletContext est invalide; l'exception imbriquée est org.xml.sax.SAXParseException: l'élément racine du document "beans" doit correspondre à la racine DOCTYPE "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 (Framewor kServlet.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.ThreadPoolExe cutor $ Worker.runTask (Source inconnue) java.util.concurrent.ThreadPoolExecutor $ Worker.run (Source inconnue) java.lang.Thread.run (Source inconnue)

J'ai ce que mon springapp- fichier 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> 

Répondre

2

Vous avez probablement d'anciens fichiers jar source dans votre classpath. Voir aussi forum post.

+0

J'ai téléchargé les pots du site et les ai ajoutés à nouveau et cela a fonctionné - ne semble pas avoir de sens, mais je vais le prendre. – Ankur

0

J'ai eu le même problème. oui, cela est dû à une mauvaise version du pot de printemps dans votre chemin de classe.

0

Le problème sera dû aux anciens fichiers jar liés au printemps. Donc, mettre à jour les fichiers jar avec le dernier, il va résoudre votre problème.