异常问题记录 redis java dubbo
2017-12-04 21:39
447 查看
启动dubbo端服务器报错:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jedisPool' defined in file [D:\gaoji\workspace\ego-soa\ego-rpc\ego-rpc-service-impl\target\classes\com\ego\config\spring\applicationContext-jedis.xml]: Unsatisfied
dependency expressed through constructor parameter 0: Could not convert argument value of type [java.lang.String] to required type [org.apache.commons.pool2.impl.GenericObjectPoolConfig]: Failed to convert value of type 'java.lang.String' to required type
'org.apache.commons.pool2.impl.GenericObjectPoolConfig'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.apache.commons.pool2.impl.GenericObjectPoolConfig': no matching editors or conversion
strategy found
错误分析:根据报错是我的 applicationContext-jedis配置文件的问题.好吧,单独把配置文件拎出来看,根据错误提示找到id="jedisPool" bean对象,发现把手残把ref写成了value,导致以上报错.红色标记处修改为ref,启动正常.
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描spring注解 -->
<context:component-scan base-package="com.ego.jedis.dao"></context:component-scan>
<!-- 配置连接池配置信息 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<!-- 最大连接数 -->
<property name="maxTotal" value="30" />
<!-- 最大空闲连接数 -->
<property name="maxIdle" value="10" />
<!-- 每次释放连接的最大数目 -->
<property name="numTestsPerEvictionRun" value="1024" />
<!-- 释放连接的扫描间隔(毫秒) -->
<property name="timeBetweenEvictionRunsMillis" value="30000" />
<!-- 连接最小空闲时间 -->
<property name="minEvictableIdleTimeMillis" value="1800000" />
<!-- 连接空闲多久后释放, 当空闲时间>该值 且 空闲连接>最大空闲连接数 时直接释放 -->
<property name="softMinEvictableIdleTimeMillis" value="10000" />
<!-- 获取连接时的最大等待毫秒数,小于零:阻塞不确定的时间,默认-1 -->
<property name="maxWaitMillis" value="1500" />
<!-- 在获取连接的时候检查有效性, 默认false -->
<property name="testOnBorrow" value="true" />
<!-- 在空闲时检查有效性, 默认false -->
<property name="testWhileIdle" value="true" />
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
<property name="blockWhenExhausted" value="false" />
</bean>
<!-- jeids整合spring单机版连接池 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="6379"/>
<constructor-arg name="poolConfig" value="jedisPoolConfig"/>
</bean>
<!-- jedisCluster -->
<bean id="jedisCluster" class="redis.clients.jedis.JedisCluster">
<constructor-arg name="poolConfig" ref="jedisPoolConfig"/>
<constructor-arg name="nodes">
<set>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7001"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7002"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7003"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7004"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7005"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7006"/>
</bean>
</set>
</constructor-arg>
</bean>
</beans>
常见报错第2弹:
dubbo启动报错信息:noserializableexception或runtimeexception[13 xxxx]
原因分析:使用dubbo的时候,对象的参数或者返回值没有实现serializable接口,
解决方案:对dubbo中的方法的参数及返回值如果是自定义对象类型,实现serializable接口即可
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jedisPool' defined in file [D:\gaoji\workspace\ego-soa\ego-rpc\ego-rpc-service-impl\target\classes\com\ego\config\spring\applicationContext-jedis.xml]: Unsatisfied
dependency expressed through constructor parameter 0: Could not convert argument value of type [java.lang.String] to required type [org.apache.commons.pool2.impl.GenericObjectPoolConfig]: Failed to convert value of type 'java.lang.String' to required type
'org.apache.commons.pool2.impl.GenericObjectPoolConfig'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.apache.commons.pool2.impl.GenericObjectPoolConfig': no matching editors or conversion
strategy found
错误分析:根据报错是我的 applicationContext-jedis配置文件的问题.好吧,单独把配置文件拎出来看,根据错误提示找到id="jedisPool" bean对象,发现把手残把ref写成了value,导致以上报错.红色标记处修改为ref,启动正常.
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描spring注解 -->
<context:component-scan base-package="com.ego.jedis.dao"></context:component-scan>
<!-- 配置连接池配置信息 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<!-- 最大连接数 -->
<property name="maxTotal" value="30" />
<!-- 最大空闲连接数 -->
<property name="maxIdle" value="10" />
<!-- 每次释放连接的最大数目 -->
<property name="numTestsPerEvictionRun" value="1024" />
<!-- 释放连接的扫描间隔(毫秒) -->
<property name="timeBetweenEvictionRunsMillis" value="30000" />
<!-- 连接最小空闲时间 -->
<property name="minEvictableIdleTimeMillis" value="1800000" />
<!-- 连接空闲多久后释放, 当空闲时间>该值 且 空闲连接>最大空闲连接数 时直接释放 -->
<property name="softMinEvictableIdleTimeMillis" value="10000" />
<!-- 获取连接时的最大等待毫秒数,小于零:阻塞不确定的时间,默认-1 -->
<property name="maxWaitMillis" value="1500" />
<!-- 在获取连接的时候检查有效性, 默认false -->
<property name="testOnBorrow" value="true" />
<!-- 在空闲时检查有效性, 默认false -->
<property name="testWhileIdle" value="true" />
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
<property name="blockWhenExhausted" value="false" />
</bean>
<!-- jeids整合spring单机版连接池 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="6379"/>
<constructor-arg name="poolConfig" value="jedisPoolConfig"/>
</bean>
<!-- jedisCluster -->
<bean id="jedisCluster" class="redis.clients.jedis.JedisCluster">
<constructor-arg name="poolConfig" ref="jedisPoolConfig"/>
<constructor-arg name="nodes">
<set>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7001"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7002"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7003"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7004"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7005"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg name="host" value="192.168.78.130"/>
<constructor-arg name="port" value="7006"/>
</bean>
</set>
</constructor-arg>
</bean>
</beans>
常见报错第2弹:
dubbo启动报错信息:noserializableexception或runtimeexception[13 xxxx]
原因分析:使用dubbo的时候,对象的参数或者返回值没有实现serializable接口,
解决方案:对dubbo中的方法的参数及返回值如果是自定义对象类型,实现serializable接口即可
相关文章推荐
- java redis client无法连接redis服务获取连接池问题处理记录
- spring+dubbo+java8 Component-scan异常记录
- redis集群java实践问题记录
- Redis主从同步异常问题记录
- spring+dubbo+java8 Component-scan异常记录(2)
- Redis主从同步异常问题记录
- CentOS 6.9环境下配置Nginx,Python,Mysql,Java,Redis环境及问题记录
- Java通过Jedis连接Redis异常,错误记录
- java异常代码编写应该注意的问题
- HPUX环境,在WebLogic服务器中使用java调用C动态连接库异常问题总结
- 对于JAVA基础测试中常见的异常问题汇总
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();出现空指针异常的问题
- weblogic 出现 java.net.SocketException 异常可能是一个页面的小问题导致的。
- 关于Hibernate中fatch=eager的bag集合(一个java List)使用Criteria查询出现重复记录的问题
- Tomcat的异常 java.lang.IllegalArgumentException: Document base 发现问题解决问题
- Java调试的重要,异常处理中输入异常处理问题
- Java异常框架中finally执行、及其他相关问题
- 【原创】如何解决java.net.SocketException 异常问题
- Java自动装箱的异常问题
- Java持久化框架(MYSQL Annotation JPA)添加记录,出现表格不存在异常的解决方法?