Invalid property 'annotatedClass…
2017-01-05 11:35
435 查看
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'factory' defined in class path resource
[applicationContext.xml]: Error setting property values; nested
exception is
org.springframework.beans.NotWritablePropertyException: Invalid
property 'annotatedClasses' of bean class
[org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Bean
property 'annotatedClasses' is not writable or has an invalid
setter method. Does the parameter type of the setter match the
return type of the getter?
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
……
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'annotatedClasses' of bean class
[org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Bean
property 'annotatedClasses' is not writable or has an invalid
setter method. Does the parameter type of the setter match the
return type of the getter?
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:801)
……
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
... 38 more
在Hibernate Annotation Spring
整合的时候出现的:
解决方法:
<bean id="myDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<!-- results in
a setDriverClassName(String) call -->
<property
name="driverClassName"
value="net.sourceforge.jtds.jdbc.Driver"/>
<property
name="url"
value="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=db_ajax"/>
<property
name="username" value="123"/>
<property
name="password" value="123"/>
</bean>
<bean id="factory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property
name="dataSource"
ref="myDataSource"></property>
<property
name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
</props>
</property>
<property
name="annotatedClasses">
<list>
<value>com.yin.hibernate.GuestBook</value>
</list>
</property>
</bean>
在 Hibernate distribution Spring整合时
<bean id="myDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<!-- results in
a setDriverClassName(String) call -->
<property
name="driverClassName"
value="net.sourceforge.jtds.jdbc.Driver"/>
<property
name="url"
value="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=db_ajax"/>
<property
name="username" value="123"/>
<property
name="password" value="123"/>
</bean>
<bean id="factory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property
name="dataSource"
ref="myDataSource"></property>
<property
name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
</props>
</property>
<property
name="mappingResources">
<list>
<value>com/yin/hibernate/GuestBook.hbm.xml</value>
</list>
</property>
</bean>
上面只需要注意红色的部分就行了
我出错的是用到了annotation注解
没有用"org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"类
creating bean with name 'factory' defined in class path resource
[applicationContext.xml]: Error setting property values; nested
exception is
org.springframework.beans.NotWritablePropertyException: Invalid
property 'annotatedClasses' of bean class
[org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Bean
property 'annotatedClasses' is not writable or has an invalid
setter method. Does the parameter type of the setter match the
return type of the getter?
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
……
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'annotatedClasses' of bean class
[org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Bean
property 'annotatedClasses' is not writable or has an invalid
setter method. Does the parameter type of the setter match the
return type of the getter?
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:801)
……
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
... 38 more
在Hibernate Annotation Spring
整合的时候出现的:
解决方法:
<bean id="myDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<!-- results in
a setDriverClassName(String) call -->
<property
name="driverClassName"
value="net.sourceforge.jtds.jdbc.Driver"/>
<property
name="url"
value="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=db_ajax"/>
<property
name="username" value="123"/>
<property
name="password" value="123"/>
</bean>
<bean id="factory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property
name="dataSource"
ref="myDataSource"></property>
<property
name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
</props>
</property>
<property
name="annotatedClasses">
<list>
<value>com.yin.hibernate.GuestBook</value>
</list>
</property>
</bean>
在 Hibernate distribution Spring整合时
<bean id="myDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<!-- results in
a setDriverClassName(String) call -->
<property
name="driverClassName"
value="net.sourceforge.jtds.jdbc.Driver"/>
<property
name="url"
value="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=db_ajax"/>
<property
name="username" value="123"/>
<property
name="password" value="123"/>
</bean>
<bean id="factory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property
name="dataSource"
ref="myDataSource"></property>
<property
name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
</props>
</property>
<property
name="mappingResources">
<list>
<value>com/yin/hibernate/GuestBook.hbm.xml</value>
</list>
</property>
</bean>
上面只需要注意红色的部分就行了
我出错的是用到了annotation注解
没有用"org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"类
相关文章推荐
- Invalid property 'annotatedClasses' of bean class
- Invalid property &#039…
- Invalid property 'annotatedClasses' of bean class
- Invalid property 'name' of bean class
- Invalid property 'transactionManager' of bean class的解决办法
- error:&nbsp;invalid&nbsp;storage&nbsp;class&nbsp;for…
- Bean property 'annotatedClasses' is not writable or has an invalid setter method
- Invalid property 'annotatedClasses' of bean class
- Invalid property 'driver_class' of bean class
- Property 'XXX'&nb…
- Invalid property 'url' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]
- Invalid property 'initialSize' of bean class 问题解决
- tomcat启动报错:Invalid property 'userService' of bean class [xxxx]: No property 'xxx' found
- Invalid property 'transactionManager' of bean class的解决办法
- Class&nbsp;&#039;org.apache.comm…
- class&nbsp;&#039;org.springframe…
- org.springframework.beans.InvalidPropertyException: Invalid property 'htd' of bean class [com.dao.im
- PHP提示 Fatal error: Class 'DOMD…
- 四、Invalid property 'dataSource' of bean class [xxx.dao.JdbcUserDao]: Bean property
- There is no getter for property named '**' in 'class java.lang.String