Skip to content

自定义ExportListener,并在dubbo:service中配置listener为该自定义的ExportListener,服务启动失败 #6269

@Root-Fang

Description

@Root-Fang
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.6
  • Operating System version: mac 10.15
  • Java version: 1.8.0.231

Steps to reproduce this issue

  1. spring boot应用中自定义ExportListener SPI扩展,记为X
  2. 在dubbo:service中设置listener为XXX
  3. 启动spring boot应用

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?
应用正常启动

Actual Result

What actually happens?
异常堆栈如下,我跟踪了一下代码执行,问题出在org.apache.dubbo.config.utils.ConfigValidationUtils#validateServiceConfig方法中,先校验了一次ExporterListener.class的扩展点,而后在validateAbstractInterfaceConfig(config)中,针对同一个ServiceConfig校验了一次 InvokerListener.class的扩展。这个地方我感觉有问题,因为我是针对dubbo:service设置的ExporterListener,而InvokerListener因为是针对dubbo:reference的,为何针对dubbo:service也去校验InvokerListener扩展呢?

java.lang.IllegalStateException: No such extension XXX for listener/org.apache.dubbo.rpc.InvokerListener
at org.apache.dubbo.config.utils.ConfigValidationUtils.checkMultiExtension(ConfigValidationUtils.java:531)
at org.apache.dubbo.config.utils.ConfigValidationUtils.validateAbstractInterfaceConfig(ConfigValidationUtils.java:299)
at org.apache.dubbo.config.utils.ConfigValidationUtils.validateServiceConfig(ConfigValidationUtils.java:316)
at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:283)
at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:193)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.lambda$exportServices$15(DubboBootstrap.java:917)
at java.util.HashMap$Values.forEach(HashMap.java:981)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.exportServices(DubboBootstrap.java:905)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:745)
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:59)
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:52)
at org.apache.dubbo.config.spring.context.OneTimeExecutionApplicationContextEventListener.onApplicationEvent(OneTimeExecutionApplicationContextEventListener.java:40)
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:403)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
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:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at cn.edu.bupt.Starter.main(Starter.java:18)

If there is an exception, please attach the exception trace:

Just put your stack trace here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions