You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/24 07:50:05 UTC

[GitHub] [dubbo] haoyann opened a new issue, #10209: [3.0]Application discovery use http protocol throw NPX

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

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   - [x] 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.8
   * Operating System version: xxx
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1. Import `dubbo-rpc-http` 
     ```
           <dependency>
               <groupId>org.apache.dubbo.extensions</groupId>
               <artifactId>dubbo-rpc-http</artifactId>
               <version>1.0.0</version>
               <exclusions>
                   <exclusion>
                       <artifactId>dubbo-cluster</artifactId>
                       <groupId>org.apache.dubbo</groupId>
                   </exclusion>
                   <exclusion>
                       <artifactId>dubbo-remoting-http</artifactId>
                       <groupId>org.apache.dubbo</groupId>
                   </exclusion>
                   <exclusion>
                       <artifactId>dubbo-rpc-api</artifactId>
                       <groupId>org.apache.dubbo</groupId>
                   </exclusion>
                   <exclusion>
                       <artifactId>spring-context</artifactId>
                       <groupId>org.springframework</groupId>
                   </exclusion>
               </exclusions>
           </dependency>
           <dependency>
               <groupId>org.eclipse.jetty</groupId>
               <artifactId>jetty-server</artifactId>
           </dependency>
           <dependency>
               <groupId>org.eclipse.jetty</groupId>
               <artifactId>jetty-servlet</artifactId>
           </dependency>
     ```
   2. Provider use `http` protocol 
      `dubbo.protocol.name=http`
   3. Consumer reference use `http` protocol 
       `@DubboReference(protocol = "http")`
   
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   If there is an exception, please attach the exception trace:
   
   ```
   java.lang.NullPointerException
   	at org.apache.dubbo.common.URL.setProtocol(URL.java:347)
   	at org.apache.dubbo.rpc.protocol.http.HttpProtocol.doRefer(HttpProtocol.java:143)
   	at org.apache.dubbo.rpc.protocol.AbstractProxyProtocol.protocolBindingRefer(AbstractProxyProtocol.java:109)
   	at org.apache.dubbo.rpc.protocol.AbstractProtocol.refer(AbstractProtocol.java:126)
   	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:77)
   	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:85)
   	at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:74)
   	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.registry.client.ServiceDiscoveryRegistryDirectory.toInvokers(ServiceDiscoveryRegistryDirectory.java:294)
   	at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.refreshInvoker(ServiceDiscoveryRegistryDirectory.java:225)
   	at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.refreshOverrideAndInvoker(ServiceDiscoveryRegistryDirectory.java:153)
   	at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.notify(ServiceDiscoveryRegistryDirectory.java:147)
   	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.lambda$notifyAddressChanged$5(ServiceInstancesChangedListener.java:397)
   	at java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1597)
   	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.notifyAddressChanged(ServiceInstancesChangedListener.java:388)
   	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.doOnEvent(ServiceInstancesChangedListener.java:199)
   	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.onEvent(ServiceInstancesChangedListener.java:112)
   	at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.registerServiceWatcher(ZookeeperServiceDiscovery.java:171)
   	at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.lambda$addServiceInstancesChangedListener$3(ZookeeperServiceDiscovery.java:120)
   ```
   ### How to solve
   HttpProtocol will set url protocol to `http` , but `InstanceAddressURL#urlAddress`  is null. 
   
   https://github.com/apache/dubbo-spi-extensions/blob/1a30787aee2dcab44c39c122120932dc5d0a2786/dubbo-rpc-extensions/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java#L143
   
   ![image](https://user-images.githubusercontent.com/43994656/175488798-25198fbf-1b5d-4a46-b555-d733eccb19f9.png)
   
   Url protocol already is `http` , maybe this step should be removed.
   ![image](https://user-images.githubusercontent.com/43994656/175489138-a713ba03-8966-4410-be35-f677bfef7e93.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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] haoyann commented on issue #10209: [3.0]Application discovery use http protocol throw NPX

Posted by GitBox <gi...@apache.org>.
haoyann commented on issue #10209:
URL: https://github.com/apache/dubbo/issues/10209#issuecomment-1171855164

   Fixed close.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] MartianQiu commented on issue #10209: [3.0]Application discovery use http protocol throw NPX

Posted by GitBox <gi...@apache.org>.
MartianQiu commented on issue #10209:
URL: https://github.com/apache/dubbo/issues/10209#issuecomment-1165306634

   I'll fix it, please assign to me.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] haoyann closed issue #10209: [3.0]Application discovery use http protocol throw NPX

Posted by GitBox <gi...@apache.org>.
haoyann closed issue #10209: [3.0]Application discovery use http protocol throw NPX
URL: https://github.com/apache/dubbo/issues/10209


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org