File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Why this error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Why this error?" Watch "Why this error?" New topic

Why this error?

Neranja dileepa

Joined: Aug 14, 2009
Posts: 1

00:56:25,281 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from file [C:\Documents and Settings\Dileepa\Desktop\newhib\bean.xml]
00:56:25,312 WARN [XmlBeanFactory] Ignored XML validation warning: org.xml.sax.SAXParseException: Valid documents must have a <!DOCTYPE declaration.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 2 in XML document from file [C:\Documents and Settings\Dileepa\Desktop\newhib\bean.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Element type "beans" is not declared.
org.xml.sax.SAXParseException: Element type "beans" is not declared.
at org.apache.crimson.parser.Parser2.error(
at org.apache.crimson.parser.Parser2.maybeElement(
at org.apache.crimson.parser.Parser2.parseInternal(
at org.apache.crimson.parser.Parser2.parse(
at org.apache.crimson.parser.XMLReaderImpl.parse(
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(
at pack.student.main(

here I hv attached my bean file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<!-- /////////////////////////////////////////////////////////// -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />

<bean id="studentintface" class="pack.studentdao">
<property name="hibernateTemplate" ref="hibernateTemplate" />
<!-- /////////////////////////////////////////////////////////// -->

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<property name="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
<!--/////////////////////////////////////////////////////////// -->

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/db" />
<property name="username" value="root" />
<property name="password" value="" />

Nickolas Case
Ranch Hand

Joined: Apr 26, 2008
Posts: 98
Have you found your issue? For one you are missing your opening <beans> tag
I agree. Here's the link:
subject: Why this error?
It's not a secret anymore!