问题遇到的现象和发生背景
启动时报错,测试也没有跑起来,来看看是怎么回事
问题相关代码,请勿粘贴截图
"C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\jbr\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\lib\idea_rt.jar=54842:C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\plugins\junit\lib\junit-rt.jar;D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-service\target\test-classes;D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-service\target\classes;D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-interface\target\classes;D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-entity\target\classes;D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-dao\target\classes;D:\software\repository\jstl\jstl\1.2\jstl-1.2.jar;D:\software\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\software\repository\javax\servlet\jsp-api\2.0\jsp-api-2.0.jar;D:\software\repository\org\springframework\spring-context\5.0.6.RELEASE\spring-context-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-aop\5.0.6.RELEASE\spring-aop-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-core\5.0.6.RELEASE\spring-core-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-jcl\5.0.6.RELEASE\spring-jcl-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-expression\5.0.6.RELEASE\spring-expression-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-beans\5.0.6.RELEASE\spring-beans-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-webmvc\5.0.6.RELEASE\spring-webmvc-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-web\5.0.6.RELEASE\spring-web-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-jdbc\5.0.6.RELEASE\spring-jdbc-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-tx\5.0.6.RELEASE\spring-tx-5.0.6.RELEASE.jar;D:\software\repository\org\springframework\spring-aspects\5.0.6.RELEASE\spring-aspects-5.0.6.RELEASE.jar;D:\software\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;D:\software\repository\org\mybatis\mybatis\3.2.8\mybatis-3.2.8.jar;D:\software\repository\org\mybatis\mybatis-spring\1.2.2\mybatis-spring-1.2.2.jar;D:\software\repository\com\alibaba\druid\1.0.9\druid-1.0.9.jar;D:\software\repository\mysql\mysql-connector-java\5.1.32\mysql-connector-java-5.1.32.jar;D:\software\repository\com\alibaba\dubbo\2.5.7\dubbo-2.5.7.jar;D:\software\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;D:\software\repository\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;D:\software\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;D:\software\repository\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;D:\software\repository\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;D:\software\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\software\repository\jline\jline\0.9.94\jline-0.9.94.jar;D:\software\repository\io\netty\netty\3.7.0.Final\netty-3.7.0.Final.jar;D:\software\repository\com\github\sgroschupf\zkclient\0.1\zkclient-0.1.jar;D:\software\repository\javassist\javassist\3.11.0.GA\javassist-3.11.0.GA.jar;D:\software\repository\com\alibaba\fastjson\1.2.47\fastjson-1.2.47.jar;D:\software\repository\junit\junit\4.12\junit-4.12.jar;D:\software\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\software\repository\org\springframework\spring-test\5.0.6.RELEASE\spring-test-5.0.6.RELEASE.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 test.TestService,register
log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/D:/software/repository/org/mybatis/mybatis/3.2.8/mybatis-3.2.8.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl' defined in file [D:\workspace\idea\guoz-dubbo-parent\guoz-dubbo-service\target\classes\service\impl\UserServiceImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Failed to register dubbo://192.168.150.1:20880/service.UserService?anyhost=true&application=guoz-dubbo-service&default.timeout=100000&dubbo=2.5.7&generic=false&interface=service.UserService&methods=register&pid=20216&side=provider×tamp=1661420619262 to registry 192.168.150.128:2181, cause: Failed to register dubbo://192.168.150.1:20880/service.UserService?anyhost=true&application=guoz-dubbo-service&default.timeout=100000&dubbo=2.5.7&generic=false&interface=service.UserService&methods=register&pid=20216&side=provider×tamp=1661420619262 to zookeeper zookeeper://192.168.150.128:2181/com.alibaba.dubbo.registry.RegistryService?application=guoz-dubbo-service&dubbo=2.5.7&interface=com.alibaba.dubbo.registry.RegistryService&pid=20216×tamp=1661420619203, cause: Zookeeper is not connected yet!
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:587)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:107)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:243)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 24 more
Caused by: java.lang.IllegalStateException: Failed to register dubbo://192.168.150.1:20880/service.UserService?anyhost=true&application=guoz-dubbo-service&default.timeout=100000&dubbo=2.5.7&generic=false&interface=service.UserService&methods=register&pid=20216&side=provider×tamp=1661420619262 to registry 192.168.150.128:2181, cause: Failed to register dubbo://192.168.150.1:20880/service.UserService?anyhost=true&application=guoz-dubbo-service&default.timeout=100000&dubbo=2.5.7&generic=false&interface=service.UserService&methods=register&pid=20216&side=provider×tamp=1661420619262 to zookeeper zookeeper://192.168.150.128:2181/com.alibaba.dubbo.registry.RegistryService?application=guoz-dubbo-service&dubbo=2.5.7&interface=com.alibaba.dubbo.registry.RegistryService&pid=20216×tamp=1661420619203, cause: Zookeeper is not connected yet!
at com.alibaba.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:149)
at com.alibaba.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:120)
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:54)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:92)
at com.alibaba.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java)
at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:499)
at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:351)
at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:312)
at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:211)
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessAfterInitialization(AnnotationBean.java:191)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1710)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)
... 38 more
Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to register dubbo://192.168.150.1:20880/service.UserService?anyhost=true&application=guoz-dubbo-service&default.timeout=100000&dubbo=2.5.7&generic=false&interface=service.UserService&methods=register&pid=20216&side=provider×tamp=1661420619262 to zookeeper zookeeper://192.168.150.128:2181/com.alibaba.dubbo.registry.RegistryService?application=guoz-dubbo-service&dubbo=2.5.7&interface=com.alibaba.dubbo.registry.RegistryService&pid=20216×tamp=1661420619203, cause: Zookeeper is not connected yet!
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:112)
at com.alibaba.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:136)
... 50 more
Caused by: java.lang.IllegalStateException: Zookeeper is not connected yet!
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkClientWrapper.createPersistent(ZkClientWrapper.java:82)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.createPersistent(ZkclientZookeeperClient.java:45)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:47)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:110)
... 51 more
Process finished with exit code -1
运行结果及报错内容
这是服务端测试结果