File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes loading error in application context file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "loading error in application context file" Watch "loading error in application context file" New topic
Author

loading error in application context file

anoopsingh it
Greenhorn

Joined: Jun 06, 2012
Posts: 1
Hi all,
I am facing issue into the loading the applicationcontext.xm file.

<?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.0.xsd">

<bean id="test" class="test.Test" init-method="init">
<property name="resource"><value>classpath:test2.txt</value></property>
<property name="fichier"><value>classpath:test.txt</value></property>
</bean>

</beans>

when i am loading this file container is throwing this error.

INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".


can anyone give suggestion reagrding this error.

Thanks
Anoop
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

What version of Spring are you using. If it isn't Spring 2.0 you would get that error because

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">;

in your schemaLocation.

Try removing the "-2.0" part and see if that works. If that doesn't fix it, then you are missing the Spring jars in your classpath.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: loading error in application context file
 
Similar Threads
Why this error?
BeanDefinitionStoreException
Strange Spring problem
Why cannot ApplicationContext find an existing file?
The matching wildcard is strict, but no declaration can be found for element 'context:annotation'