Problem with Hibernate.


D

Dips

Hi,

I am getting an exception while using spring with hibernate, which is
precisely this..

Error
parsing XML: XML InputStream(28) The content of element type "class"
must match
"(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|
composite-
id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-
on
e|one-to-one|component|dynamic-component|properties|any|map|set|list|
bag
|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|
union
-subclass*),loader?,sql-insert?,sql-update?,sql-
delete?,filter*,resultse
t*,(query|sql-query)*)".
02 Feb 2009 19:32:48,582 INFO [main]
(DefaultSingletonBeanRegistry.java:421) - Destroying singletons in
org.s[email protected]1b1
7d49: defining beans
[mainDataSource,sessionFactory,webpageDao,webpageHandler,mainTransaction
Manager,org.springframework.aop.config.internalAutoProxyCreator,org.spri
ngframework.transaction.annotation.AnnotationTransactionAttributeSource#
0,org.springframework.transaction.interceptor.TransactionInterceptor#0,o
rg.springframework.transaction.config.internalTransactionAdvisor,viewRes
olver,openSessionInView,urlMapping]; root of factory hierarchy
02 Feb 2009 19:32:48,598 ERROR [main] (ContextLoader.java:215) -
Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating
bean with name 'sessionFactory' defined in ServletContext resource
[/WEB-INF/classes/applicationContext.xml]: Invocation of init method
failed; nested exception is org.hibernate.InvalidMappingException:
Could
not parse mapping document from invalid mapping





The mapping file is this..



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.globallogic.requestmonitoring.beans.Webpage"
table="webpage" catalog="printeverywhere">

<id name="webpageId" column="webpage_id" type="integer">
<generator class="native" />
</id>

<property name="webpageName" column="webpage_name"
type="string" />
<property name="url" column="url" type="string" />
<property name="status" column="status" type="integer" />
<one-to-one name="userWebpageMapping"
class="com.globallogic.requestmonitoring.beans.UserWebpageMapping"
constrained="true" />
</class>
<class
name="com.globallogic.requestmonitoring.beans.UserWebpageMapping"
table="user_webpage_mapping" catalog="printeverywhere">
<property name="webpageId" column="webpage_id" type="integer" />

<property name="userId" column="user_id" type="integer" />

</class>
</hibernate-mapping>

and the applicationContext.xml file is this..


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="mainDataSource" scope="prototype"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl"
value="jdbc:mysql://localhost/requestmonitoring" />
<property name="properties">
<props>
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</prop>
<prop key="c3p0.acquire_increment">1</prop>
<prop key="c3p0.idle_test_period">3000</prop>
<prop key="c3p0.max_size">15</prop>
<prop key="c3p0.max_statements">100</prop>
<prop key="c3p0.min_size">1</prop>
<prop key="user">root</prop>
<prop key="password">mysql</prop>
</props>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="mainDataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.show_sql">true</prop>
<prop key="hibernate.max_fetch_depth">4</prop>
<prop key="hibernate.cache.use_second_level_cache">
true
</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop
key="hibernate.cache.provider_configuration_file_resource_path">
WEB-INF/classes/ehcache.xml
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop><!-- stats -->
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">
true
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>
com/globallogic/requestmonitoring/beans/Webpage.hbm.xml
</value>

</list>
</property>
</bean>
<bean id="webpageDao"

class="com.globallogic.requestmonitoring.service.dao.hibernate.WebpageDaoImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="webpageHandler"
class="com.globallogic.requestmonitoring.handlers.WebpageHandler">
<property name="webpageDao" ref="webpageDao" />
</bean>
<bean id="mainTransactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="mainTransactionManager" />
</beans>



If anybody knows the solution to it.. please help me out. I need it
urgently..

Thanks a ton,

Dipesh
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top