异常如下: 在整合spring和Mybatis,刚开始进行查询映射时没有问题,在进行插入映射时一直报空指针异常,后来把插入部分的Mapper映射文件和Dao层接口方法删除到原来还是不行,后来网上查了查,发现问题,在使用接口传递参数时,原来使用的是Map传递参数,后来使用JavaBean传递参数,新增加了一个Bean,但是忘记使用@Autowired注解修饰.所以会报空指针异常.…
使用Spring boot整合Hive,在启动Spring boot项目时,报出异常: java.lang.NoSuchMethodError: org.eclipse.jetty.servlet.ServletMapping.setDefault(Z)V 经过排查,是maven的包冲突引起的,具体做法,排除:jetty-all.hive-shims依赖包.对应的pom配置如下: <dependency> <groupId>org.apache.hive</groupId&g…
https://blog.csdn.net/RicardoDing/article/details/79899686 近期,在使用spring和mybatis框架编写代码时,sqlSession不需要手动关闭这一点引起了我的兴趣.我们都知道,单独使用mybatis时,sqlSeesion使用完毕后是需要进行手动关闭的,但为什么在和spring整合后就不需要了呢?在查阅了资料后得知,这是使用了spring中的AOP面向切面编程和动态代理技术.但是我认为脱离代码谈技术就是耍流氓.因此,我对 MyBa…
手动获取容器对象时,报no qualifying bean of type is defined, 经过调查,发现手动获取的时候,该类所在的包必须经过spring容器初始化. 1.SpringConfigHolder 代码,添加@Component进行ioc package com.xxxxxxx.utils.holder; import org.springframework.beans.BeansException; import org.springframework.context.Ap…
Redis的下载与安装 在Linux上使用wget http://download.redis.io/releases/redis-5.0.0.tar.gz下载源码到指定位置 解压:tar -xvf redis-5.0.0.tar.gz cd redis-5.0.0.tar.gz make:编译(如果Linux上没有装gcc编译环境,则执行yum -y install gcc-c++) make install:把Redis的cli和server添加到bin中,相当于配置环境变量 vim red…
在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is not valid without active transaction ... 因为我用到的是session是通过sessionFactory.getCurrentSession()方法获得到的,这个session是和事务(transaction)绑定的,这个异常是告诉我,session的操作没有在…
@Test public void testSpringJedisPool(){ ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-*.xml"); JedisPool pool = (JedisPool)ac.getBean("redisClient"); Jedis jedis = pool.getResource();…
写在前面: 1. 本例使用 Hibernate3 + Spring3: 2. 本例的查询使用了 HibernateTemplate: 1. 导入 ehcache-x.x.x.jar 包: 2. 在 applicationContext.xml 文件中找到 sessionFactory 相应的配置信息并在设置 hibernateProperties 中添加如下代码: ? 1 2 3 4 5 6 <!-- 配置使用查询缓存 --> <prop key="hibernate.cach…
问题 1.学习测试时发现了一级缓存并没有生效,先看案例: setting配置: <settings> <!-- (1) 提供可控制Mybatis框架运行行为的属性信息 --> <setting name="lazyLoadingEnabled" value="false" /> <setting name="logImpl" value="STDOUT_LOGGING" /> &…
在启动项目时报解析xml文件异常:   org.xml.sax.SAXParseException: cvc-complex-type.2.4.c 'aop:config'......   由报错提示可知,是aop产生的问题,打开配置文件,经过查看后才知道是没有加aop声明:   <!--开启基于注解的事务,使用xml配置形式的事务(必要主要的都是使用配置式) --> <aop:config> <!-- 切入点表达式 --> <aop:pointcut expre…