以下是升级到spring后我遇到的错误。
Caused by:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 20 in XML document from class path resource [dataStoreContext.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'local' is not allowed to appear in element 'ref'.
我使用的Hibernate版本是3.0
下面是我的上下文xml使用
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>cdqiDS</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
</property>
编辑1:将本地更改为bean后,我收到以下错误
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.context.support.ClassPathXmlApplicationContext]:
Constructor threw exception; nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in class path
resource [dataStoreContext.xml]:
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: org/springframework/jdbc/support/lob/LobHandler
答案 0 :(得分:0)
将org.springframework.jdbc.jar
添加到您的类路径中。