{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-dubbo/issues/2855","repository_url":"https://api.github.com/repos/apache/incubator-dubbo","labels_url":"https://api.github.com/repos/apache/incubator-dubbo/issues/2855/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-dubbo/issues/2855/comments","events_url":"https://api.github.com/repos/apache/incubator-dubbo/issues/2855/events","html_url":"https://github.com/apache/incubator-dubbo/issues/2855","id":386047404,"node_id":"MDU6SXNzdWUzODYwNDc0MDQ=","number":2855,"title":"2.6.5问题，ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler#bean","user":{"login":"gMan1990","id":5050994,"node_id":"MDQ6VXNlcjUwNTA5OTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5050994?v=4","gravatar_id":"","url":"https://api.github.com/users/gMan1990","html_url":"https://github.com/gMan1990","followers_url":"https://api.github.com/users/gMan1990/followers","following_url":"https://api.github.com/users/gMan1990/following{/other_user}","gists_url":"https://api.github.com/users/gMan1990/gists{/gist_id}","starred_url":"https://api.github.com/users/gMan1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gMan1990/subscriptions","organizations_url":"https://api.github.com/users/gMan1990/orgs","repos_url":"https://api.github.com/users/gMan1990/repos","events_url":"https://api.github.com/users/gMan1990/events{/privacy}","received_events_url":"https://api.github.com/users/gMan1990/received_events","type":"User","site_admin":false},"labels":[{"id":7331964,"node_id":"MDU6TGFiZWw3MzMxOTY0","url":"https://api.github.com/repos/apache/incubator-dubbo/labels/type/bug","name":"type/bug","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":{"login":"mercyblitz","id":533114,"node_id":"MDQ6VXNlcjUzMzExNA==","avatar_url":"https://avatars0.githubusercontent.com/u/533114?v=4","gravatar_id":"","url":"https://api.github.com/users/mercyblitz","html_url":"https://github.com/mercyblitz","followers_url":"https://api.github.com/users/mercyblitz/followers","following_url":"https://api.github.com/users/mercyblitz/following{/other_user}","gists_url":"https://api.github.com/users/mercyblitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mercyblitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercyblitz/subscriptions","organizations_url":"https://api.github.com/users/mercyblitz/orgs","repos_url":"https://api.github.com/users/mercyblitz/repos","events_url":"https://api.github.com/users/mercyblitz/events{/privacy}","received_events_url":"https://api.github.com/users/mercyblitz/received_events","type":"User","site_admin":false},"assignees":[{"login":"mercyblitz","id":533114,"node_id":"MDQ6VXNlcjUzMzExNA==","avatar_url":"https://avatars0.githubusercontent.com/u/533114?v=4","gravatar_id":"","url":"https://api.github.com/users/mercyblitz","html_url":"https://github.com/mercyblitz","followers_url":"https://api.github.com/users/mercyblitz/followers","following_url":"https://api.github.com/users/mercyblitz/following{/other_user}","gists_url":"https://api.github.com/users/mercyblitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mercyblitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercyblitz/subscriptions","organizations_url":"https://api.github.com/users/mercyblitz/orgs","repos_url":"https://api.github.com/users/mercyblitz/repos","events_url":"https://api.github.com/users/mercyblitz/events{/privacy}","received_events_url":"https://api.github.com/users/mercyblitz/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/apache/incubator-dubbo/milestones/22","html_url":"https://github.com/apache/incubator-dubbo/milestone/22","labels_url":"https://api.github.com/repos/apache/incubator-dubbo/milestones/22/labels","id":3751384,"node_id":"MDk6TWlsZXN0b25lMzc1MTM4NA==","number":22,"title":"2.6.6","description":null,"creator":{"login":"nzomkxia","id":1183397,"node_id":"MDQ6VXNlcjExODMzOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/1183397?v=4","gravatar_id":"","url":"https://api.github.com/users/nzomkxia","html_url":"https://github.com/nzomkxia","followers_url":"https://api.github.com/users/nzomkxia/followers","following_url":"https://api.github.com/users/nzomkxia/following{/other_user}","gists_url":"https://api.github.com/users/nzomkxia/gists{/gist_id}","starred_url":"https://api.github.com/users/nzomkxia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzomkxia/subscriptions","organizations_url":"https://api.github.com/users/nzomkxia/orgs","repos_url":"https://api.github.com/users/nzomkxia/repos","events_url":"https://api.github.com/users/nzomkxia/events{/privacy}","received_events_url":"https://api.github.com/users/nzomkxia/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":28,"state":"open","created_at":"2018-10-19T07:24:47Z","updated_at":"2019-02-22T06:24:12Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2018-11-30T05:49:17Z","updated_at":"2019-02-25T01:42:13Z","closed_at":"2019-02-22T06:22:43Z","author_association":"NONE","body":"* dubbo: 2.6.5\r\n* 测试，所以提供者和消费者在同一个jvm里\r\n\r\n------\r\nReferenceBeanInvocationHandler的invoke就是消费者方法执行后会调用到的方法，它有个init方法用来初始化bean字段，这个方法有两处调用：\r\n1. https://github.com/apache/incubator-dubbo/blob/38e0f15be33a5edb35b45d2c5d7c6be753bdd888/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java#L128\r\n```\r\nprivate InvocationHandler buildInvocationHandler(String referencedBeanName, ReferenceBean referenceBean) {\r\n    ReferenceBeanInvocationHandler handler = localReferenceBeanInvocationHandlerCache.get(referencedBeanName);\r\n    if (handler == null) {\r\n        handler = new ReferenceBeanInvocationHandler(referenceBean);\r\n    }\r\n    if (applicationContext.containsBean(referencedBeanName)) { // Is local @Service Bean or not ?\r\n        // ReferenceBeanInvocationHandler's initialization has to wait for current local @Service Bean has been exported.\r\n        localReferenceBeanInvocationHandlerCache.put(referencedBeanName, handler);\r\n    } else {\r\n        // Remote Reference Bean should initialize immediately\r\n        handler.init();\r\n    }\r\n    return handler;\r\n}\r\n```\r\n2. https://github.com/apache/incubator-dubbo/blob/38e0f15be33a5edb35b45d2c5d7c6be753bdd888/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java#L230\r\n```\r\nprivate void initReferenceBeanInvocationHandler(ServiceBean serviceBean) {\r\n    String serviceBeanName = serviceBean.getBeanName();\r\n    // Remove ServiceBean when it's exported\r\n    ReferenceBeanInvocationHandler handler = localReferenceBeanInvocationHandlerCache.remove(serviceBeanName);\r\n    // Initialize\r\n    if (handler != null) {\r\n        handler.init();\r\n    }\r\n}\r\n```\r\n\r\n------\r\n因为是测试所以：1处走的是```if (applicationContext.containsBean(referencedBeanName))```里面，不会调用```handler.init();```，2处我断点到handler都是null所以也不会调用```handler.init();```\r\n所以那个bean字段都是null。然后执行invoke方法就是：\r\n```\r\njava.lang.NullPointerException\r\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n    at java.lang.reflect.Method.invoke(Method.java:498)\r\n    at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.invoke(ReferenceAnnotationBeanPostProcessor.java:159)\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/incubator-dubbo/issues/comments/466843204","html_url":"https://github.com/apache/incubator-dubbo/issues/2855#issuecomment-466843204","issue_url":"https://api.github.com/repos/apache/incubator-dubbo/issues/2855","id":466843204,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2Njg0MzIwNA==","user":{"login":"flyer5200","id":3270930,"node_id":"MDQ6VXNlcjMyNzA5MzA=","avatar_url":"https://avatars3.githubusercontent.com/u/3270930?v=4","gravatar_id":"","url":"https://api.github.com/users/flyer5200","html_url":"https://github.com/flyer5200","followers_url":"https://api.github.com/users/flyer5200/followers","following_url":"https://api.github.com/users/flyer5200/following{/other_user}","gists_url":"https://api.github.com/users/flyer5200/gists{/gist_id}","starred_url":"https://api.github.com/users/flyer5200/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyer5200/subscriptions","organizations_url":"https://api.github.com/users/flyer5200/orgs","repos_url":"https://api.github.com/users/flyer5200/repos","events_url":"https://api.github.com/users/flyer5200/events{/privacy}","received_events_url":"https://api.github.com/users/flyer5200/received_events","type":"User","site_admin":false},"created_at":"2019-02-25T01:42:13Z","updated_at":"2019-02-25T01:42:13Z","author_association":"NONE","body":"> Thanks for your report, We also found this issue, will be fixed on 2.6.6\r\n\r\nThis problem still exists in 2.6.6 or 2.7.0, please confirm!"}}
{"actor":{"display_login":"flyer5200"}}