现在 该项目引入一个jar包 jar包中有dubbo filter
代码很简单 打印了个日志 就继续往下执行了
jar包中 META-INF 也写了 建立了dubbo文件夹 并写了com.alibaba.dubbo.rpc.Filter 内容为aFilter=xxx.FilterImpl
引入jar包后 provider重启没有问题 只要一启动consumer 就会报错:
17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:java.io.tmpdir=/var/folders/by/k2p_g58n2fz8qb_sy32dpltm0000gn/T/ 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:java.compiler=<NA> 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.name=Mac OS X 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.arch=x86_64 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.version=10.12.6 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.name=benjamin 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.home=/Users/benjamin 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.dir=/Users/benjamin/workspace/light-framework-project 17-11-20.15:14:02.485 INFO ZooKeeper - Initiating client connection, connectString=127.0.0.1:12183 sessionTimeout=30000 watcher=org.I0Itec.zkclient.ZkClient@552b8081 17-11-20.15:14:02.503 INFO ZkClient - Waiting for keeper state SyncConnected 17-11-20.15:14:02.506 INFO ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:12183. Will not attempt to authenticate using SASL (unknown error) 17-11-20.15:14:02.515 INFO ClientCnxn - Socket connection established to 127.0.0.1/127.0.0.1:12183, initiating session 17-11-20.15:14:02.524 INFO ClientCnxn - Session establishment complete on server 127.0.0.1/127.0.0.1:12183, sessionid = 0x15fd52b6e5e0061, negotiated timeout = 30000 17-11-20.15:14:02.525 INFO ZkClient - zookeeper state changed (SyncConnected) Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.benjamin.project.dubbo.api.DubboTest. No provider available for the service com.benjamin.project.dubbo.api.DubboTest from the url zookeeper://127.0.0.1:12183/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.benjamin.project.dubbo.api.DubboTest&methods=dubboTest&pid=44866&revision=1.0-SNAPSHOT&side=consumer×tamp=1511162042381 to the consumer 192.168.2.1 use dubbo version 2.5.3 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:217) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:350) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968) at net.shmin.performance.dubbo.DubboTestMain.main(DubboTestMain.java:17) Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.benjamin.project.dubbo.api.DubboTest. No provider available for the service com.benjamin.project.dubbo.api.DubboTest from the url zookeeper://127.0.0.1:12183/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.benjamin.project.dubbo.api.DubboTest&methods=dubboTest&pid=44866&revision=1.0-SNAPSHOT&side=consumer×tamp=1511162042381 to the consumer 192.168.2.1 use dubbo version 2.5.3 at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420) at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300) 17-11-20.15:14:02.797 INFO ZkEventThread - Terminate ZkClient event thread. at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138) 17-11-20.15:14:02.798 INFO ZooKeeper - Session: 0x15fd52b6e5e0061 closed at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ... 8 more Disconnected from the target VM, address: '127.0.0.1:54957', transport: 'socket' 17-11-20.15:14:02.798 INFO ClientCnxn - EventThread shut down for session: 0x15fd52b6e5e0061
No provider available for the service com.benjamin.project.dubbo.api.DubboTest from the url zookeeper://127.0.0.1:12183/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.benjamin.project.dubbo.api.DubboTest&methods=dubboTest&pid=44866&revision=1.0-SNAPSHOT&side=consumer×tamp=1511162042381 to the consumer 192.168.2.1
根据报错,先检查对应的provider是否启动,可以进zookeeper看下
应用监控,想做dubbo的监控.查到可以用filter来做 写了个dubbo demo, 不加filter正常运行. 项目工程内加filter 也没有问题, 正常运行.
现在 该项目引入一个jar包 jar包中有dubbo filter 代码很简单 打印了个日志 就继续往下执行了 jar包中 META-INF 也写了 建立了dubbo文件夹 并写了com.alibaba.dubbo.rpc.Filter 内容为aFilter=xxx.FilterImpl 引入jar包后 provider重启没有问题 只要一启动consumer 就会报错:
17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:java.io.tmpdir=/var/folders/by/k2p_g58n2fz8qb_sy32dpltm0000gn/T/ 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:java.compiler=<NA> 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.name=Mac OS X 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.arch=x86_64 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:os.version=10.12.6 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.name=benjamin 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.home=/Users/benjamin 17-11-20.15:14:02.484 INFO ZooKeeper - Client environment:user.dir=/Users/benjamin/workspace/light-framework-project 17-11-20.15:14:02.485 INFO ZooKeeper - Initiating client connection, connectString=127.0.0.1:12183 sessionTimeout=30000 watcher=org.I0Itec.zkclient.ZkClient@552b8081 17-11-20.15:14:02.503 INFO ZkClient - Waiting for keeper state SyncConnected 17-11-20.15:14:02.506 INFO ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:12183. Will not attempt to authenticate using SASL (unknown error) 17-11-20.15:14:02.515 INFO ClientCnxn - Socket connection established to 127.0.0.1/127.0.0.1:12183, initiating session 17-11-20.15:14:02.524 INFO ClientCnxn - Session establishment complete on server 127.0.0.1/127.0.0.1:12183, sessionid = 0x15fd52b6e5e0061, negotiated timeout = 30000 17-11-20.15:14:02.525 INFO ZkClient - zookeeper state changed (SyncConnected) Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.benjamin.project.dubbo.api.DubboTest. No provider available for the service com.benjamin.project.dubbo.api.DubboTest from the url zookeeper://127.0.0.1:12183/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.benjamin.project.dubbo.api.DubboTest&methods=dubboTest&pid=44866&revision=1.0-SNAPSHOT&side=consumer×tamp=1511162042381 to the consumer 192.168.2.1 use dubbo version 2.5.3 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:217) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:350) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968) at net.shmin.performance.dubbo.DubboTestMain.main(DubboTestMain.java:17) Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.benjamin.project.dubbo.api.DubboTest. No provider available for the service com.benjamin.project.dubbo.api.DubboTest from the url zookeeper://127.0.0.1:12183/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.benjamin.project.dubbo.api.DubboTest&methods=dubboTest&pid=44866&revision=1.0-SNAPSHOT&side=consumer×tamp=1511162042381 to the consumer 192.168.2.1 use dubbo version 2.5.3 at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420) at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300) 17-11-20.15:14:02.797 INFO ZkEventThread - Terminate ZkClient event thread. at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138) 17-11-20.15:14:02.798 INFO ZooKeeper - Session: 0x15fd52b6e5e0061 closed at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ... 8 more Disconnected from the target VM, address: '127.0.0.1:54957', transport: 'socket' 17-11-20.15:14:02.798 INFO ClientCnxn - EventThread shut down for session: 0x15fd52b6e5e0061
把jar包拿掉就能正确的执行了. 请问 这个问题是怎么回事 怎么解决? 我需要jar包中写filter做监控用.