Skip to Content
0
Former Member
Jun 12, 2006 at 02:25 PM

Document root element is missing: migrating spring app from tomcat

51 Views

Hi!

can anybody help me with this issue?

I have ported my tomcat spring application to netweaver(6.40, SP 17, Windows 2k SP4) and i get the following error:

"

Error occured in invoking event "contextInitialized()" on listener clas

s com.webapp.listener.StartupListener. The error is: org.springfram

ework.beans.factory.BeanCreationException: Error creating bean with nam

e 'sessionFactory' defined in ServletContext resource [/WEB-INF/applica

tionContext-hibernate.xml]: Initialization of bean failed; nested excep

tion is org.hibernate.MappingException: Could not parse mapping documen

t in input stream

org.hibernate.MappingException: Could not parse mapp

ing document in input stream

at org.hibernate.cfg.Configuration.addIn

putStream(Configuration.java:430)

at org.springframework.orm.hibernat

e3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.j

ava:654)

at org.springframework.beans.factory.support.AbstractAutowir

eCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactor

y.java:1059)

at org.springframework.beans.factory.support.AbstractAut

owireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.j

ava:363)

at org.springframework.beans.factory.support.AbstractBeanFac

tory.getBean(AbstractBeanFactory.java:226)

at org.springframework.bea

ns.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java

:147)

at org.springframework.beans.factory.support.DefaultListableBea

nFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)

at org.springframework.context.support.AbstractApplicationContext.ref

resh(AbstractApplicationContext.java:320)

at org.springframework.web.

context.support.AbstractRefreshableWebApplicationContext.refresh(Abstra

ctRefreshableWebApplicationContext.java:134)

at org.springframework.w

eb.context.ContextLoader.createWebApplicationContext(ContextLoader.java

:246)

at org.springframework.web.context.ContextLoader.initWebApplica

tionContext(ContextLoader.java:184)

at org.springframework.web.contex

t.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:4

9)

at com.ifx.webapp.listener.StartupListener.contextInitialized(Star

tupListener.java:42)

at com.sap.engine.services.servlets_jsp.server.r

untime.context.WebEvents.contextInitialized(WebEvents.java:45)

at com

.sap.engine.services.servlets_jsp.server.container.ApplicationThreadIni

tializer.run(ApplicationThreadInitializer.java:112)

at com.sap.engine

.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.sec

urity.AccessController.doPrivileged(Native Method)

at com.sap.engine.

core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.

sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

C

aused by: org.dom4j.DocumentException: Error on line 1 of document : D

ocument root element is missing. Nested exception: Document root elemen

t is missing.

at org.dom4j.io.SAXReader.read(SAXReader.java:482)

at

org.hibernate.cfg.Configuration.addInputStream(Configuration.java:421)

... 18 more

"

And yes, the xml files are valid xml files at least in anything i've used to look at them (eclipse, ultraedit, notepad, ie) :).....

Thank you!

ps. the file:

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

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"

"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<!-- Hibernate SessionFactory -->

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource" ref="dataSource"/>

<property name="mappingResources">

<list>

<value>package/ModelObj1.hbm.xml</value>

<value>package/ModelObj2.hbm.xml</value>

</list>

</property>

<property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>

</props>

</property>

</bean>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<property name="sessionFactory" ref="sessionFactory"/>

</bean>

<!-- Generic DAO - can be used when doing standard CRUD -->

<bean id="dao" class="com.dao.hibernate.BaseDAOHibernate">

<property name="sessionFactory" ref="sessionFactory"/>

</bean>

</beans>