1.忘记了写包名,只写了类名
org.hibernate.MappingException: Association references unmapped class: Address
2.
getter和setter的名字写错了!!!
Initial SessionFactory creation failed.org.hibernate.PropertyNotFoundException
3
spring中bean的ref的的位置错了
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'user' defined in file [/home/song/programer/eclipse/workspace/spring2/src/com/song/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'myhome' of bean class [com.song.User]: Bean property 'myhome' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
4
使用myeclipse6,datasource数据源出问题
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
Caused by:
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getDeclaredConstructor(Class.java:1953)
……
从日志信息看问题已经很明显了,是applicationContext.xml的dataSource问题。
解决方法:
方法1 将
改为之后问题得到解决。(org.springframework.jdbc.datasource.DriverManagerDataSource 不可以使用连接池。)
方法2 org.apache.commons.dbcp.BasicDataSource作为注入的DataSource源,为了使用 DBCP的功能,必须要将commons-dbcp.jar加入CLASSPATH中,另外还需要commons-pool.jar和commons- collections.jar,这些都可以在Spring的lib目录下找到。
org.springframework.jdbc.datasource.DriverManagerDataSource 并没有提供连接池的功能,只能作作简单的单机连接测试。使用org.apache.commons.dbcp.BasicDataSource时缺少 commons-pool.jar所以会出现如题的问题。
5
contentType="text/html; charset=gbk"
中写成了contextType="",打错了字
.JasperException: /showTree1.jsp(1,1) PWC6039: Page directive has invalid attribute: contextType
6
在spring的运用,整合struts当中action-servlet.xml的bean不是id,而是name
小心,小心
bean name="/login"
7
contentType="text/html; charset=gbk"
中写成了contextType="",打错了字
.JasperException: /showTree1.jsp(1,1) PWC6039: Page directive has invalid attribute: contextType
8
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes" >
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
transactionAttributes,忘写了's',查了很久的错误,no setter is found错误,以后要小心!!
9
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
主要是把user表设置成了native,而本身没有设置userid这个属性,改成assigned,由程序指定即可(小心检查myeclipse生成的pojo类及配置文件是否合理)
10
在applicationContext.xml,spring的配置文件中,代理的拦截器同facadeManager文件相冲突,发生error:
no setter property for"target"
原因是缺少spring-aop.jar包
org.hibernate.MappingException: Association references unmapped class: Address
2.
getter和setter的名字写错了!!!
Initial SessionFactory creation failed.org.hibernate.PropertyNotFoundException
3
spring中bean的ref的的位置错了
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'user' defined in file [/home/song/programer/eclipse/workspace/spring2/src/com/song/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'myhome' of bean class [com.song.User]: Bean property 'myhome' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
4
使用myeclipse6,datasource数据源出问题
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
Caused by:
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getDeclaredConstructor(Class.java:1953)
……
从日志信息看问题已经很明显了,是applicationContext.xml的dataSource问题。
解决方法:
方法1 将
改为之后问题得到解决。(org.springframework.jdbc.datasource.DriverManagerDataSource 不可以使用连接池。)
方法2 org.apache.commons.dbcp.BasicDataSource作为注入的DataSource源,为了使用 DBCP的功能,必须要将commons-dbcp.jar加入CLASSPATH中,另外还需要commons-pool.jar和commons- collections.jar,这些都可以在Spring的lib目录下找到。
org.springframework.jdbc.datasource.DriverManagerDataSource 并没有提供连接池的功能,只能作作简单的单机连接测试。使用org.apache.commons.dbcp.BasicDataSource时缺少 commons-pool.jar所以会出现如题的问题。
5
contentType="text/html; charset=gbk"
中写成了contextType="",打错了字
.JasperException: /showTree1.jsp(1,1) PWC6039: Page directive has invalid attribute: contextType
6
在spring的运用,整合struts当中action-servlet.xml的bean不是id,而是name
小心,小心
bean name="/login"
7
contentType="text/html; charset=gbk"
中写成了contextType="",打错了字
.JasperException: /showTree1.jsp(1,1) PWC6039: Page directive has invalid attribute: contextType
8
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes" >
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
transactionAttributes,忘写了's',查了很久的错误,no setter is found错误,以后要小心!!
9
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
主要是把user表设置成了native,而本身没有设置userid这个属性,改成assigned,由程序指定即可(小心检查myeclipse生成的pojo类及配置文件是否合理)
10
在applicationContext.xml,spring的配置文件中,代理的拦截器同facadeManager文件相冲突,发生error:
no setter property for"target"
原因是缺少spring-aop.jar包