New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Mock 进行测试时虽然调用成功但还是会报错 #338

Closed
nibocn opened this Issue Jan 16, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@nibocn

nibocn commented Jan 16, 2017

Client xml 配置:

<motan:registry regProtocol="consul" name="my_consul" address="127.0.0.1:8500"/>

    <motan:basicReferer id="myBasicRef" group="motan_server_sample" registry="my_consul"
                        filter="mock" check="false"/>
    <motan:referer id="userRpcService" interface="me.nibo.motan.rpc.api.UserRpcService"
                   basicReferer="myBasicRef"
                   directUrl="127.0.0.1:8001"
                   mock="me.nibo.motan.client.mock.UserRpcServiceMock"/>

异常信息:

2017-01-16 14:49:36,683 [New I/O client boss #1] ERROR [error:87] - NettyChannelHandler exceptionCaught: remote=null local=null event=java.net.ConnectException: Connection refused
java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
2017-01-16 14:49:36,685 [main] ERROR [error:87] - NettyClient init pool create connect Error: url=motan://127.0.0.1:8001/me.nibo.motan.rpc.api.UserRpcService
com.weibo.api.motan.exception.MotanServiceException: error_message: NettyChannel failed to connect to server, url: motan://127.0.0.1:8001/me.nibo.motan.rpc.api.UserRpcService, result: true, success: false, connected: false, status: 503, error_code: 10001,r=null
	at com.weibo.api.motan.transport.netty.NettyChannel.open(NettyChannel.java:150)
	at com.weibo.api.motan.transport.netty.NettyChannelFactory.makeObject(NettyChannelFactory.java:53)
	at org.apache.commons.pool.impl.GenericObjectPool.addObject(GenericObjectPool.java:1691)
	at com.weibo.api.motan.transport.AbstractPoolClient.initPool(AbstractPoolClient.java:64)
	at com.weibo.api.motan.transport.netty.NettyClient.open(NettyClient.java:217)
	at com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer.doInit(DefaultRpcProtocol.java:196)
	at com.weibo.api.motan.rpc.AbstractNode.init(AbstractNode.java:46)
	at com.weibo.api.motan.protocol.AbstractProtocol.refer(AbstractProtocol.java:100)
	at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator.refer(ProtocolFilterDecorator.java:70)
	at com.weibo.api.motan.cluster.support.ClusterSupport.notify(ClusterSupport.java:175)
	at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:82)
	at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:55)
	at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
	at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
	at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
	at com.weibo.api.motan.config.springsupport.RefererConfigBean.getObject(RefererConfigBean.java:44)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1590)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
	at me.nibo.motan.client.RpcClient.main(RpcClient.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
2017-01-16 14:49:36,686 [New I/O client boss #1] ERROR [error:87] - NettyChannelHandler exceptionCaught: remote=null local=null event=java.net.ConnectException: Connection refused
java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
2017-01-16 14:49:36,686 [main] ERROR [error:87] - NettyClient init pool create connect Error: url=motan://127.0.0.1:8001/me.nibo.motan.rpc.api.UserRpcService
com.weibo.api.motan.exception.MotanServiceException: error_message: NettyChannel failed to connect to server, url: motan://127.0.0.1:8001/me.nibo.motan.rpc.api.UserRpcService, result: true, success: false, connected: false, status: 503, error_code: 10001,r=null
	at com.weibo.api.motan.transport.netty.NettyChannel.open(NettyChannel.java:150)
	at com.weibo.api.motan.transport.netty.NettyChannelFactory.makeObject(NettyChannelFactory.java:53)
	at org.apache.commons.pool.impl.GenericObjectPool.addObject(GenericObjectPool.java:1691)
	at com.weibo.api.motan.transport.AbstractPoolClient.initPool(AbstractPoolClient.java:64)
	at com.weibo.api.motan.transport.netty.NettyClient.open(NettyClient.java:217)
	at com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer.doInit(DefaultRpcProtocol.java:196)
	at com.weibo.api.motan.rpc.AbstractNode.init(AbstractNode.java:46)
	at com.weibo.api.motan.protocol.AbstractProtocol.refer(AbstractProtocol.java:100)
	at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator.refer(ProtocolFilterDecorator.java:70)
	at com.weibo.api.motan.cluster.support.ClusterSupport.notify(ClusterSupport.java:175)
	at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:82)
	at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:55)
	at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
	at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
	at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
	at com.weibo.api.motan.config.springsupport.RefererConfigBean.getObject(RefererConfigBean.java:44)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1590)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
	at me.nibo.motan.client.RpcClient.main(RpcClient.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
@nibocn

This comment has been minimized.

Show comment
Hide comment
@nibocn

nibocn commented Jan 16, 2017

参考的 #279

@rayzhang0603

This comment has been minimized.

Show comment
Hide comment
@rayzhang0603

rayzhang0603 Jan 16, 2017

Collaborator

虽然mock并不会真的发送信息,但是初始化时还是会尝试与directUrl建立链接的。这个异常不会对client端功能有影响,忽略即可。

Collaborator

rayzhang0603 commented Jan 16, 2017

虽然mock并不会真的发送信息,但是初始化时还是会尝试与directUrl建立链接的。这个异常不会对client端功能有影响,忽略即可。

@nibocn

This comment has been minimized.

Show comment
Hide comment
@nibocn

nibocn Jan 16, 2017

OK,谢谢了

nibocn commented Jan 16, 2017

OK,谢谢了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment