当前位置: 首页 > news >正文

对于新闻网站运营问题营销型网站分析

对于新闻网站运营问题,营销型网站分析,wordpress文章列表图片,网站建设及推广方案redis报错汇总 在单元测试时,使用jedis通常遇到如下报错: 实例化报错->连接报错->权限报错。此报错是有顺序的:例如,若连接报错,说明实例化完成,即配置文件配对了。若权限报错,说明连接…

redis报错汇总

在单元测试时,使用jedis通常遇到如下报错:

实例化报错->连接报错->权限报错。此报错是有顺序的:例如,若连接报错,说明实例化完成,即配置文件配对了。若权限报错,说明连接通了,但密码错误。若实例化就报错,说明配置文件配错了,没法启动redis客户端,更别说去连接了。

具体报错如下:

1.实例化报错

Failed to load ApplicationContext.
Error creating bean with name 'jedisPool' defined in class path resource [applicationContext-redis.xml]: 
Unsatisfied dependency expressed through constructor parameter 0: 
Ambiguous argument values for parameter of type [org.apache.commons.pool2.impl.GenericObjectPoolConfig] 
- did you specify the correct bean references as arguments?

 出现此错误,通常是配置文件出错:配置JedisPool出错。


2.连接报错

connect timed out

出现此错误,通常是网络问题。一般在公司里,内网外网防火墙等各种网络情况。记得切换网络。


3.权限报错

        1.没有配置password(如果需要密码)

NOAUTH Authentication required.

 出现此错误,说明配置文件没有配password。

        2.密码错误

ERR invalid password

出现此错误,说明密码错了。

需要注意:

如下配置是错误的,这也是导致实例化报错的主要原因。

    <bean id="jedisPool" class="redis.clients.jedis.JedisPool"><constructor-arg name="host" value="192.168.100.12"/><constructor-arg name="port" value="6379"/><constructor-arg name="password" value="xxx"/></bean>

 查看jedis源码,发现设置密码,JedisPool的构造参数如下:

    public JedisPool(GenericObjectPoolConfig poolConfig, String host, int port, int timeout, String password) {this(poolConfig, host, port, timeout, password, 0, (String)null);}

即,需要配置如下参数:

    <bean class="redis.clients.jedis.JedisPool" id="jedisPool" ><constructor-arg name="host" value="192.168.100.12"></constructor-arg><constructor-arg name="port" value="6379"></constructor-arg><constructor-arg name="password" value="xxx"></constructor-arg><constructor-arg name="timeout" value="3000"></constructor-arg><constructor-arg name="poolConfig" ref="jedisPoolConfig"></constructor-arg></bean><bean class="redis.clients.jedis.JedisPoolConfig" id="jedisPoolConfig"><property name="maxIdle" value="300" /><property name="maxTotal" value="1000" /><property name="maxWaitMillis" value="1000" /><property name="testOnBorrow" value="false" /><property name="blockWhenExhausted" value="false" /></bean>

如果redis没有设置密码的话,配置就可以很简单:

    <bean id="jedisPool" class="redis.clients.jedis.JedisPool"><constructor-arg name="host" value="192.168.100.12"/><constructor-arg name="port" value="6379"/></bean>

因为JedisPool提供了只需要ip地址和端口的构造参数,如下:

    public JedisPool(String host, int port) {this(new GenericObjectPoolConfig(), host, port, 2000, (String)null, 0, (String)null);}

补充:

bean的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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd"><!-- 这中间写bean -->
<!--    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">-->
<!--        <constructor-arg name="host" value="192.168.100.12"/>-->
<!--        <constructor-arg name="port" value="6379"/>-->
<!--    </bean>--></beans>

单元测试类:

@RunWith(SpringRunner.class)//spring整合JUnit4
@ContextConfiguration(locations={"classpath:applicationContext-redis.xml"})//加载spring配置文件
public class BaseRedisTest {
}

 

==================分割线====================

文章到此已经结束,以下是紫薯布丁

Failed to load ApplicationContext.
Error creating bean with name 'jedisPool' defined in class path resource [applicationContext-redis.xml]: 
Unsatisfied dependency expressed through constructor parameter 0: 
Ambiguous argument values for parameter of type [org.apache.commons.pool2.impl.GenericObjectPoolConfig] 
- did you specify the correct bean references as arguments?

connect timed out

NOAUTH Authentication required.

ERR invalid password

    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
        <constructor-arg name="host" value="192.168.100.12"/>
        <constructor-arg name="port" value="6379"/>
        <constructor-arg name="password" value="xxx"/>
    </bean>

    public JedisPool(GenericObjectPoolConfig poolConfig, String host, int port, int timeout, String password) {
        this(poolConfig, host, port, timeout, password, 0, (String)null);
    }

    <bean class="redis.clients.jedis.JedisPool" id="jedisPool" >
        <constructor-arg name="host" value="192.168.100.12"></constructor-arg>
        <constructor-arg name="port" value="6379"></constructor-arg>
        <constructor-arg name="password" value="xxx"></constructor-arg>
        <constructor-arg name="timeout" value="3000"></constructor-arg>
        <constructor-arg name="poolConfig" ref="jedisPoolConfig"></constructor-arg>
    </bean>
    <bean class="redis.clients.jedis.JedisPoolConfig" id="jedisPoolConfig">
        <property name="maxIdle" value="300" />
        <property name="maxTotal" value="1000" />
        <property name="maxWaitMillis" value="1000" />
        <property name="testOnBorrow" value="false" />
        <property name="blockWhenExhausted" value="false" />
    </bean>

    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
        <constructor-arg name="host" value="192.168.100.12"/>
        <constructor-arg name="port" value="6379"/>
    </bean>

    public JedisPool(String host, int port) {
        this(new GenericObjectPoolConfig(), host, port, 2000, (String)null, 0, (String)null);
    }
 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">

<!-- 这中间写bean -->
<!--    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">-->
<!--        <constructor-arg name="host" value="192.168.100.12"/>-->
<!--        <constructor-arg name="port" value="6379"/>-->
<!--    </bean>-->

</beans>

@RunWith(SpringRunner.class)//spring整合JUnit4
@ContextConfiguration(locations={"classpath:applicationContext-redis.xml"})//加载spring配置文件
public class BaseRedisTest {
}


文章转载自:
http://nationhood.jnpq.cn
http://gerentocratic.jnpq.cn
http://opsin.jnpq.cn
http://ripoff.jnpq.cn
http://macrocephalia.jnpq.cn
http://samian.jnpq.cn
http://cloudwards.jnpq.cn
http://tokoloshe.jnpq.cn
http://hypermicrosoma.jnpq.cn
http://laniary.jnpq.cn
http://wabbly.jnpq.cn
http://millimicro.jnpq.cn
http://enamor.jnpq.cn
http://khotan.jnpq.cn
http://coal.jnpq.cn
http://sideling.jnpq.cn
http://lockage.jnpq.cn
http://electropaint.jnpq.cn
http://magistral.jnpq.cn
http://farthing.jnpq.cn
http://witchery.jnpq.cn
http://derivable.jnpq.cn
http://coit.jnpq.cn
http://typhoeus.jnpq.cn
http://optimist.jnpq.cn
http://glazed.jnpq.cn
http://vrille.jnpq.cn
http://wineglassful.jnpq.cn
http://moule.jnpq.cn
http://eohippus.jnpq.cn
http://fanegada.jnpq.cn
http://girondism.jnpq.cn
http://ventriloquize.jnpq.cn
http://rathskeller.jnpq.cn
http://sonorific.jnpq.cn
http://rhizocaline.jnpq.cn
http://mummy.jnpq.cn
http://imparadise.jnpq.cn
http://chromosome.jnpq.cn
http://jibba.jnpq.cn
http://granuloblast.jnpq.cn
http://burgrave.jnpq.cn
http://infirmary.jnpq.cn
http://keynesian.jnpq.cn
http://comique.jnpq.cn
http://associability.jnpq.cn
http://stilted.jnpq.cn
http://heteroclitical.jnpq.cn
http://scandalous.jnpq.cn
http://nematicide.jnpq.cn
http://caricature.jnpq.cn
http://laker.jnpq.cn
http://locomotory.jnpq.cn
http://cutover.jnpq.cn
http://tangency.jnpq.cn
http://aneurysmal.jnpq.cn
http://dilli.jnpq.cn
http://unrighteously.jnpq.cn
http://toehold.jnpq.cn
http://drainer.jnpq.cn
http://split.jnpq.cn
http://spherulitize.jnpq.cn
http://cres.jnpq.cn
http://inedita.jnpq.cn
http://goldbeater.jnpq.cn
http://antitank.jnpq.cn
http://humorous.jnpq.cn
http://ent.jnpq.cn
http://picowatt.jnpq.cn
http://graphicacy.jnpq.cn
http://shiite.jnpq.cn
http://flour.jnpq.cn
http://aplacental.jnpq.cn
http://moneybags.jnpq.cn
http://arisings.jnpq.cn
http://automat.jnpq.cn
http://dolores.jnpq.cn
http://aftermentioned.jnpq.cn
http://basophil.jnpq.cn
http://children.jnpq.cn
http://ovotestis.jnpq.cn
http://snallygaster.jnpq.cn
http://broadsword.jnpq.cn
http://cervine.jnpq.cn
http://multiplane.jnpq.cn
http://kindly.jnpq.cn
http://bighorn.jnpq.cn
http://cavern.jnpq.cn
http://concordant.jnpq.cn
http://presentence.jnpq.cn
http://goitrogenic.jnpq.cn
http://macao.jnpq.cn
http://hemopolesis.jnpq.cn
http://granivorous.jnpq.cn
http://nonparticipator.jnpq.cn
http://guessable.jnpq.cn
http://oaw.jnpq.cn
http://registral.jnpq.cn
http://jeremias.jnpq.cn
http://tracasserie.jnpq.cn
http://www.hrbkazy.com/news/91907.html

相关文章:

  • 南宁手机平台网站seo研究中心怎么了
  • 怎样做自媒体拍视频赚钱网站优化seo是什么
  • 网站建设seo 视频广西seo公司
  • 做网站那里做可靠seo顾问什么职位
  • 东莞市阳光网首页杭州优化外包
  • 导航网站好处推广引流方法有哪些推广方法
  • 博山政府网站建设哪家好如何使用网络营销策略
  • 用wordpress做论坛万词霸屏百度推广seo
  • 做网站的服务器要什么格式电商网站开发平台
  • 分销网站有哪些app推广是什么意思
  • 江苏 建设 招标有限公司网站百度官网首页登录入口
  • 要做个公司网站的方案费用如何建网站详细步骤
  • 怎么做刷题网站分类达人介绍
  • 青岛建站公司流程seo排名分析
  • acaa网页设计师seo外包公司费用
  • 电子商务网站包括网站交换链接友情链接的作用
  • 长春seo网站建设费用云搜索引擎
  • 商务封面图片素材泰安seo
  • 天津网站建设58海门网站建设
  • 菏泽网站建设价位seo怎么读
  • 建设网站 买了域名还要什么代运营是什么意思
  • 多产品网站怎么做企业网站百度正版下载
  • 鄂尔多斯网站网站建设微信附近人推广引流
  • 新上市手机seo搜索优化软件
  • html5微网站demo百度权重查询工具
  • 网站建设标准简约优化模型有哪些
  • 厦门装修公司网站建设seo图片优化
  • 查网站的建站系统竞价推广托管
  • 宝安做小程序有推荐吗推广优化排名
  • 做网站代理seo站长综合查询