DaleShay opened a new issue, #10461:
URL: https://github.com/apache/dubbo/issues/10461

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.10
   * Operating System version: MacOS
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1. 服务端配置  dubbo.provider.serialization = java 。启动服务端
   2. 启动客户端 (客户端配置 protocol.serialization = java 和 provider.serialization = 
java 好像都不影响结果)
   
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   正常启动
   
   <!-- What do you expect from the above steps?-->
   
   ### Actual Behavior
   
   启动报空指针
   
   If there is an exception, please attach the exception trace:
   
   ```
   java.lang.NullPointerException
        at org.apache.dubbo.metadata.MetadataInfo.init(MetadataInfo.java:113)
        at 
org.apache.dubbo.registry.client.AbstractServiceDiscovery.getRemoteMetadata(AbstractServiceDiscovery.java:172)
        at 
org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.doOnEvent(ServiceInstancesChangedListener.java:152)
        at 
org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.onEvent(ServiceInstancesChangedListener.java:112)
        at 
org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribeURLs(ServiceDiscoveryRegistry.java:316)
        at 
org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.doSubscribe(ServiceDiscoveryRegistry.java:216)
        at 
org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribe(ServiceDiscoveryRegistry.java:184)
        at 
org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:111)
        at 
org.apache.dubbo.registry.integration.DynamicDirectory.subscribe(DynamicDirectory.java:180)
        at 
org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.subscribe(ServiceDiscoveryRegistryDirectory.java:108)
        at 
org.apache.dubbo.registry.integration.RegistryProtocol.doCreateInvoker(RegistryProtocol.java:570)
        at 
org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getServiceDiscoveryInvoker(InterfaceCompatibleRegistryProtocol.java:65)
        at 
org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshServiceDiscoveryInvoker(MigrationInvoker.java:436)
        at 
org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToApplicationFirstInvoker(MigrationInvoker.java:244)
        at 
org.apache.dubbo.registry.client.migration.MigrationRuleHandler.refreshInvoker(MigrationRuleHandler.java:73)
        at 
org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:57)
        at 
org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:243)
        at 
org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:535)
        at 
org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:505)
        at 
org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:487)
        at 
org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:78)
        at 
org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:74)
        at 
org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:71)
        at 
org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.refer(ProtocolSerializationWrapper.java:52)
        at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
        at 
org.apache.dubbo.config.ReferenceConfig.createInvokerForRemote(ReferenceConfig.java:520)
        at 
org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:423)
        at 
org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:288)
        at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:220)
        at 
org.apache.dubbo.config.utils.SimpleReferenceCache.destroyReference(SimpleReferenceCache.java:262)
        at 
org.apache.dubbo.config.utils.SimpleReferenceCache.destroy(SimpleReferenceCache.java:215)
        at 
org.apache.dubbo.config.utils.SimpleReferenceCache.destroy(SimpleReferenceCache.java:239)
        at 
org.apache.dubbo.config.deploy.DefaultModuleDeployer.lambda$referServices$6(DefaultModuleDeployer.java:388)
        at 
java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
        at 
org.apache.dubbo.config.deploy.DefaultModuleDeployer.referServices(DefaultModuleDeployer.java:363)
        at 
org.apache.dubbo.config.deploy.DefaultModuleDeployer.start(DefaultModuleDeployer.java:154)
        at 
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextRefreshedEvent(DubboDeployApplicationListener.java:111)
        at 
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:100)
        at 
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:45)
        at 
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
        at 
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
        at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
        at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
        at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554)
        at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at 
org.apache.dubbo.springboot.demo.consumer.ConsumerApplication.main(ConsumerApplication.java:39)
   
   ```
   可能的原因和截图
   MetadataInfo 将  initiated 字段设置为 transient 
   private transient AtomicBoolean initiated = new AtomicBoolean(false);
   
   
   MetaUtils 170行
   <img width="1042" alt="image" 
src="https://user-images.githubusercontent.com/39309978/184575283-aca17799-c0fd-47c2-8596-718c252ce895.png";>
   
   AbstractServiceDiscovery 从本地文件或远程 获取 metadata 后 init  。 initiated 为null
   <img width="784" alt="image" 
src="https://user-images.githubusercontent.com/39309978/184575545-5838e4e2-775e-42d7-826e-80e576c427d6.png";>
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to