2008-05-07 03:02:33 StandardContext[/testhbn]action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:651)
不知道是什么原因?请帮我找找原因,先谢了。
17 个解决方案
#1
这是applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://210.77.144.201:10002;DatabaseName=sune</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>lG_XhncnL@.dsfhj</value>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/suntravel/sunes/user/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.jdbc.fetch_size">10</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
<property name="fetchSize" value="20" />
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>/WEB-INF/ehcache.xml</value>
</property>
</bean>
<bean name="/user/userlist" class="com.suntravel.sunes.user.UserListAction" singleton="false">
<property name="userDAO">
<ref bean="userDAOProxy"/>
</property>
</bean>
<bean id="userDAO" class="com.suntravel.sunes.user.UserDAOImp">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target">
<ref local="userDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://210.77.144.201:10002;DatabaseName=sune</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>lG_XhncnL@.dsfhj</value>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/suntravel/sunes/user/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.jdbc.fetch_size">10</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
<property name="fetchSize" value="20" />
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>/WEB-INF/ehcache.xml</value>
</property>
</bean>
<bean name="/user/userlist" class="com.suntravel.sunes.user.UserListAction" singleton="false">
<property name="userDAO">
<ref bean="userDAOProxy"/>
</property>
</bean>
<bean id="userDAO" class="com.suntravel.sunes.user.UserDAOImp">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target">
<ref local="userDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
#2
看着像
<value>com/suntravel/sunes/user/User.hbm.xml </value>
有问题,User.hbm.xml文件没什么问题吧
<value>com/suntravel/sunes/user/User.hbm.xml </value>
有问题,User.hbm.xml文件没什么问题吧
#3
可能是包冲突问题,把hibernate-annotations.jar删掉试试看?
#4
学习一下!
#5
同意包冲突
看看 asm.jar asm-attrs.jar cglib-2.1.3.jar commons-cllections-2.1.1.jar 是否有重复的包, 如果有删除上述重复的
看看 asm.jar asm-attrs.jar cglib-2.1.3.jar commons-cllections-2.1.1.jar 是否有重复的包, 如果有删除上述重复的
#6
学习了,刚遇到了这问题。我想也是包冲突的问题。删包试试看
#7
如果是包重复了,它不会覆盖???
#8
学习
#9
xuexi 我的问题大致也是如此啊!正在找原因啊!
#10
偶也碰见这问题了,
把asm-util-2.2.3,asm-2.2.3,asm-commons-2.2.3
这三个包删除后已经恢复正常
把asm-util-2.2.3,asm-2.2.3,asm-commons-2.2.3
这三个包删除后已经恢复正常
#11
不好用
#12
我 也遇到类似的问题……可是到底删哪个jar包啊?
#13
哈哈
困扰N久的问题终于解决了
谢谢大伙啊
困扰N久的问题终于解决了
谢谢大伙啊
#14
我也遇到这样的问题,答案还是包的问题,解决了
#15
包冲图,将asm.2.2.3.jar删除就好了
#16
还有可能是因为User.hbm.xml等等的路径,名称原因。
#17
报错就很难解决这些问题。。。伤心一米 啊
#1
这是applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://210.77.144.201:10002;DatabaseName=sune</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>lG_XhncnL@.dsfhj</value>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/suntravel/sunes/user/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.jdbc.fetch_size">10</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
<property name="fetchSize" value="20" />
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>/WEB-INF/ehcache.xml</value>
</property>
</bean>
<bean name="/user/userlist" class="com.suntravel.sunes.user.UserListAction" singleton="false">
<property name="userDAO">
<ref bean="userDAOProxy"/>
</property>
</bean>
<bean id="userDAO" class="com.suntravel.sunes.user.UserDAOImp">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target">
<ref local="userDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://210.77.144.201:10002;DatabaseName=sune</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>lG_XhncnL@.dsfhj</value>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/suntravel/sunes/user/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.jdbc.fetch_size">10</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
<property name="fetchSize" value="20" />
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>/WEB-INF/ehcache.xml</value>
</property>
</bean>
<bean name="/user/userlist" class="com.suntravel.sunes.user.UserListAction" singleton="false">
<property name="userDAO">
<ref bean="userDAOProxy"/>
</property>
</bean>
<bean id="userDAO" class="com.suntravel.sunes.user.UserDAOImp">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target">
<ref local="userDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
#2
看着像
<value>com/suntravel/sunes/user/User.hbm.xml </value>
有问题,User.hbm.xml文件没什么问题吧
<value>com/suntravel/sunes/user/User.hbm.xml </value>
有问题,User.hbm.xml文件没什么问题吧
#3
可能是包冲突问题,把hibernate-annotations.jar删掉试试看?
#4
学习一下!
#5
同意包冲突
看看 asm.jar asm-attrs.jar cglib-2.1.3.jar commons-cllections-2.1.1.jar 是否有重复的包, 如果有删除上述重复的
看看 asm.jar asm-attrs.jar cglib-2.1.3.jar commons-cllections-2.1.1.jar 是否有重复的包, 如果有删除上述重复的
#6
学习了,刚遇到了这问题。我想也是包冲突的问题。删包试试看
#7
如果是包重复了,它不会覆盖???
#8
学习
#9
xuexi 我的问题大致也是如此啊!正在找原因啊!
#10
偶也碰见这问题了,
把asm-util-2.2.3,asm-2.2.3,asm-commons-2.2.3
这三个包删除后已经恢复正常
把asm-util-2.2.3,asm-2.2.3,asm-commons-2.2.3
这三个包删除后已经恢复正常
#11
不好用
#12
我 也遇到类似的问题……可是到底删哪个jar包啊?
#13
哈哈
困扰N久的问题终于解决了
谢谢大伙啊
困扰N久的问题终于解决了
谢谢大伙啊
#14
我也遇到这样的问题,答案还是包的问题,解决了
#15
包冲图,将asm.2.2.3.jar删除就好了
#16
还有可能是因为User.hbm.xml等等的路径,名称原因。
#17
报错就很难解决这些问题。。。伤心一米 啊