dubbo rest服务(消费者) java.lang.ClassNotFoundException: org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine 错误问题
1、版本
dubbo 2.7.3
2、描述
java.lang.ClassNotFoundException: org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine
2019-07-26 20:16:59,572 [main] ERROR [org.apache.dubbo.registry.integration.RegistryDirectory] - [DUBBO] Failed to refer invoker for interface:interface boazy.dubbo.demo.api.RestUserService,url:(rest://10.198.0.10:8083/boazy.dubbo.demo.api.RestUserService?anyhost=true&application=boazy-dubbo-demo-consumer&bean.name=boazy.dubbo.demo.api.RestUserService&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=boazy.dubbo.demo.api.RestUserService&lazy=false&methods=registerUser,queryUser&owner=boazy&pid=14208&protocol=rest&qos.port=33333®ister=true®ister.ip=10.198.0.10&release=2.7.3&remote.application=boazy-dubbo-demo-provider&server=jetty&side=consumer&sticky=false×tamp=1564143395915)org/jboss/resteasy/client/jaxrs/engines/ApacheHttpClient4Engine, dubbo version: 2.7.3, current host: 10.198.0.10 java.lang.NoClassDefFoundError: org/jboss/resteasy/client/jaxrs/engines/ApacheHttpClient4Engine at org.apache.dubbo.rpc.protocol.rest.RestProtocol.doRefer(RestProtocol.java:180) at org.apache.dubbo.rpc.protocol.AbstractProxyProtocol.protocolBindingRefer(AbstractProxyProtocol.java:99) at org.apache.dubbo.rpc.protocol.AbstractProtocol.refer(AbstractProtocol.java:91) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:130) at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:72) at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:71) at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) at org.apache.dubbo.registry.integration.RegistryDirectory.toInvokers(RegistryDirectory.java:423) at org.apache.dubbo.registry.integration.RegistryDirectory.refreshInvoker(RegistryDirectory.java:280) at org.apache.dubbo.registry.integration.RegistryDirectory.refreshOverrideAndInvoker(RegistryDirectory.java:239) at org.apache.dubbo.registry.integration.RegistryDirectory.notify(RegistryDirectory.java:233) at org.apache.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:418) at org.apache.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:369) at org.apache.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:360) at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:183) at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:295) at org.apache.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:172) at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:411) at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:392) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:128) at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:70) at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:69) at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:396) at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329) at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250) at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:73) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) 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:1080) at boazy.dubbo.demo.consumer.ConsumerApp.main(ConsumerApp.java:56) Caused by: java.lang.ClassNotFoundException: org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 34 more 2019-07-26 20:16:59,588 [main] ERROR [org.apache.dubbo.registry.integration.RegistryDirectory] - urls to invokers error .invokerUrls.size :1, invoker.size :0. urls :[rest://10.198.0.10:8083/boazy.dubbo.demo.api.RestUserService?anyhost=true&application=boazy-dubbo-demo-provider&bean.name=boazy.dubbo.demo.api.RestUserService&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=boazy.dubbo.demo.api.RestUserService&methods=registerUser,queryUser&owner=boazy&pid=17996®ister=true&release=2.7.3&server=jetty&side=provider×tamp=1564143395915] java.lang.IllegalStateException: urls to invokers error .invokerUrls.size :1, invoker.size :0. urls :[rest://10.198.0.10:8083/boazy.dubbo.demo.api.RestUserService?anyhost=true&application=boazy-dubbo-demo-provider&bean.name=boazy.dubbo.demo.api.RestUserService&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=boazy.dubbo.demo.api.RestUserService&methods=registerUser,queryUser&owner=boazy&pid=17996®ister=true&release=2.7.3&server=jetty&side=provider×tamp=1564143395915] at org.apache.dubbo.registry.integration.RegistryDirectory.refreshInvoker(RegistryDirectory.java:292) at org.apache.dubbo.registry.integration.RegistryDirectory.refreshOverrideAndInvoker(RegistryDirectory.java:239) at org.apache.dubbo.registry.integration.RegistryDirectory.notify(RegistryDirectory.java:233) at org.apache.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:418) at org.apache.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:369) at org.apache.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:360) at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:183) at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:295) at org.apache.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:172) at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:411) at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:392) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:128) at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:70) at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:69) at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:396) at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329) at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250) at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:73) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) 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:1080) at boazy.dubbo.demo.consumer.ConsumerApp.main(ConsumerApp.java:56) restUserService invoking error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restUserService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service boazy.dubbo.demo.api.RestUserService. No provider available for the service boazy.dubbo.demo.api.RestUserService from the url zookeeper://10.198.0.21:2181/org.apache.dubbo.registry.RegistryService?anyhost=true&application=boazy-dubbo-demo-consumer&bean.name=boazy.dubbo.demo.api.RestUserService&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=boazy.dubbo.demo.api.RestUserService&lazy=false&methods=registerUser,queryUser&owner=boazy&pid=14208&protocol=rest&qos.port=33333®ister=true®ister.ip=10.198.0.10&release=2.7.3&remote.application=boazy-dubbo-demo-provider&server=jetty&side=consumer&sticky=false×tamp=1564143418650 to the consumer 10.198.0.10 use dubbo version 2.7.3 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) 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:1080) at boazy.dubbo.demo.consumer.ConsumerApp.main(ConsumerApp.java:56) Caused by: java.lang.IllegalStateException: Failed to check the status of the service boazy.dubbo.demo.api.RestUserService. No provider available for the service boazy.dubbo.demo.api.RestUserService from the url zookeeper://10.198.0.21:2181/org.apache.dubbo.registry.RegistryService?anyhost=true&application=boazy-dubbo-demo-consumer&bean.name=boazy.dubbo.demo.api.RestUserService&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=boazy.dubbo.demo.api.RestUserService&lazy=false&methods=registerUser,queryUser&owner=boazy&pid=14208&protocol=rest&qos.port=33333®ister=true®ister.ip=10.198.0.10&release=2.7.3&remote.application=boazy-dubbo-demo-provider&server=jetty&side=consumer&sticky=false×tamp=1564143418650 to the consumer 10.198.0.10 use dubbo version 2.7.3 at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:418) at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329) at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250) at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:73) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) ... 6 more
3、解决
是 resteasy-client 版本过高引起的问题
resteasy-client 4.x.x 版本中无 ApacheHttpClient4Engine 类,4.x.x版本中叫 ApacheHttpClient43Engine 类
resteasy-client 3.8.x 版本中有ApacheHttpClient4Engine类
将 resteasy-client 4.x.x 换成 resteasy-client 3.8.x 版本,就可以解决上面的问题咯...
posted on
2019-07-26 21:39 流易 阅读(
...) 评论(
...) 编辑 收藏