Spring遇到的错误

1.配置Aop的时候出错了;主要原因是用xml配置aop时,配置before的时候,before是带参数的,没配好少配了and args(user)

<aop:before method="before" arg-names="user" pointcut="execution(public * cw.ok.spring.aop.*.add*(..)) " />
<aop:before method="before" arg-names="user" pointcut="execution(public * cw.ok.spring.aop.*.add*(..))and args(user)" />

错误:Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao1' defined in file [D:\Workspaces\MyEclipse 8.5\Sprin……

一般applicationContext.xml中配置AOP的时候没配好就会出这样的问题!

2.配置spring整合hibernate时,配数据源 驱动时<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >没有加入相关的包;少了两个包:commons-pool.jar commons-dbcp.jar 。


xml提示错误:Class 'org.apache.commons.dbcp.BasicDataSource' n;

3.配置spring事务管理的时候,报错:

spring aop报错:Cannot proxy target class because CGLIB2 is not available.

原因是:没导入jar包 导入cglib-nodep-2.1_3.jar包,或者导入asm-2.2.3.jar和cglib-2.2.jar

4.本来是建一个person表,老是出错!寻找了很多时间的错误,原来是数据库中已经存在了person这张表,而且是外键关联,是无法直接删它的,以后建表之前一定要先看数据库中是否已经存在这种表名,或者是保留字段

Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: 
Caused by: org.hibernate.exception.SQLGrammarException: could not insert: [cw.ok.test.po.Person]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'age' in 'field list'



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值