学习中遇到问题--记录
2016-12-18 13:18
218 查看
异常
1.spring依赖于日志
异常:Java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
解决:加入commons-logging-1.1.3.jar
2.
异常:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext
解决:
ApplicationContext ctx = new ClassPathXmlApplicationContext();
改为ApplicationContext ctx = new ClassPathXmlApplicationContext(“beans.xml”);
其中beans.xml是spring bean的配置文件
3.spring2.5
异常:Error creating bean with name ‘userService’: Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.mashibing.service.UserService.setUserDao(com.mashibing.dao.UserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.mashibing.dao.UserDao] is defined: Unsatisfied dependency of type [interface com.mashibing.dao.UserDao]: expected at least 1 matching bean
解决:
设置自动注入(@Autowired )的bean(setUserDao)没有在xml文件中定义
4.
异常:error at ::0 can’t find referenced pointcut performance
解决:
如果要使用AspectJ完成注解切面需要注意下面的JDK与AspectJ的匹配:
JDK1.6 —— aspectJ1.6
JDK1.7 —— aspectJ1.7.3+
5.
异常:cannot proxy target class because CGLIB2 is not available
解决:
加入CGLIB2的包cglib-nodep-2.1_3.jar
注:
一个类若实现了接口,会用jdk自带的proxy和invocationhandler来产生代理;若没有实现接口,会采用直接操作二进制码的方式(即CGLIB)来帮你产生代理的代码
6.
异常:nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPoo
解决:
加入commons-pool.jar
7.
异常:Cannot load JDBC driver class ‘com.mysql.jdbc.Driver’
解决:
缺少驱动,加入mysql驱动
8建立maven工程报错
异常:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories
解决:
将本地maven仓库中maven-archetype-quickstart文件夹全部删除,再重新建立maven工程,会自动重新下载
9.maven工程测试连接mysql数据库
异常:Error creating bean with name ‘dataSource’ defined in class path resource [conf/dbconfig.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver
解决:
驱动没有加载进来,maven工程pom.xml中加入依赖mysql
10.
异常:generate mybatis config执行后生成bean类报错alias cannot resolved to a type
解决:
缺少mybatis包,maven工程加入依赖
11.
异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): ….TTestMybatisMapper.selectByPrimaryKey
解决:
Mapper.xml文件中mapper namespace定义错误
相关文章推荐
- 对GWT-EXT学习时遇到的问题,详细记录下来
- 今天遇到多线程,windowsService的问题---学习记录
- 记录Spring.net学习中遇到的各种问题
- 持续记录-修改--写写自己Android学习中遇到的关键性问题
- cmake 学习之路 记录中间所遇到过的所有错误与问题的解决 <三>
- 今天开始使用这个blog来记录我的学习中遇到的问题吧
- 最近学习过程中遇到的问题,记录一下
- 新学习JAVA,记录遇到的各种奇葩问题
- nodejs 学习过程遇到问题记录1
- ITK+VTK 混编学习过程中遇到的问题记录
- 学习使用solr时遇到的一些问题,记录
- 记录学习旅途所遇到的问题-ubuntu
- 【烦人的小问题】自己各种遇到的问题,搜到答案就来这记录一份,也当做学习记忆
- cmake 学习之路 记录中间所遇到过的所有错误与问题的解决 <一>
- [项目过程中所遇到的各种问题记录]学习篇——对工作以来的学习过的开源项目进行总结—DiscuzNt
- C#中ArrayList 与 string、string[]数组 的转换 (转学习:今天做项目时遇到一个arrylist转换问题,做记录)
- 学习OpenGL遇到的一些问题,记录下以备用。
- 学习linux中遇到的小问题记录
- 新开博客,督促自己在学习过程中遇到的问题或者好的想法都记录下来
- cmake 学习之路 记录中间所遇到过的所有错误与问题的解决 <二>