z281654498 2016-10-06 03:07 采纳率: 0%
浏览 6541

jedis与springmvc 集成,JedisPoolConfig 找不到类异常

最近需要用redis和springmvc做集成,于是我根据网上的例子在现有框架上集成jedis
1.使用jedis-2.7.3.jar(已检查过没有重复包,”cvtrl+左键“可以找到该类)
2.现在框架中已经集成了memcached,shiro,mybaits(不知道是否有冲突)
3.建立了spring-context-redis.xml文件,文件内容如下:

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd">
    <!-- 加载配置属性文件 -->
    <context:property-placeholder ignore-unresolvable="true" location="classpath*:/redis.properties" />

    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxIdle" value="300"/> <!--最大能够保持idel状态的对象数-->
        <property name="maxTotal" value="60000"/><!--最大分配的对象数-->
        <property name="testOnBorrow" value="true"/><!--当调用borrow Oject方法时,是否进行有效性检查-->
    </bean>

    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
        <constructor-arg index="0" ref="jedisPoolConfig"/>
        <constructor-arg index="1" value="${redis.host}"/>
        <constructor-arg index="2" value="${redis.port}" type="int"/>
        <constructor-arg index="3" value="${redis.timeout}" type="int"/>
        <constructor-arg index="4" value="${redis.auth}"/>
    </bean>
</beans>

运行后报错:

 Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.JedisPoolConfig

对这问题百度各种搜,搜到国外一个哥们也出现了这种情况,但是没有人解答
有遇到过同样问题的兄弟或者能帮我指点一下的高手吗?
如果我有描述不周的地方请各位指出,我会再增加详尽描述
感激不尽

  • 写回答

3条回答

  • Levisoft 2016-10-08 02:36
    关注

    是不是少包了?用反编译工具看下那个包里面是否有redis.clients.jedis.JedisPoolConfig这个类

    评论

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝