Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Invoker not found. #15047

Open
4 tasks done
L1yp opened this issue Jan 10, 2025 · 0 comments
Open
4 tasks done

[Bug] Invoker not found. #15047

L1yp opened this issue Jan 10, 2025 · 0 comments
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage

Comments

@L1yp
Copy link

L1yp commented Jan 10, 2025

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

dubbo version: 3.3.2
springboot: 3.2.5
jdk: 21

Steps to reproduce this issue

dependency:

      <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-autoconfigure-compatible</artifactId>
        <version>3.3.2</version>
      </dependency>
      <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>3.3.2</version>
      </dependency>

spring-gateway:
application.yml:

spring:
  application:
    name: @artifactId@
  profiles:
    active: @profiles.active@
  cloud:
    nacos:
      discovery:
        server-addr: @nacos.discovery.server-addr@
      server-addr:  @nacos.discovery.server-addr@
    gateway:
      routes:
        - id: v-system-service-impl
          uri: lb://v-system-service-impl
          predicates:
            - name: Path
              args:
                pattern: /system/**
          filters:
            - StripPrefix=1
          metadata:
            name: 系统服务
        - id: v-file-service-impl
          uri: lb://v-file-service-impl
          predicates:
            - name: Path
              args:
                pattern: /file/**
          filters:
            - StripPrefix=1
          metadata:
            name: 文件服务
server:
  port: 8000

openapi config:

import static org.springdoc.core.utils.Constants.DEFAULT_API_DOCS_URL;

@Configuration
public class OpenApiConfig {

    @Bean
    @Lazy(false)
    public Set<SwaggerUrl> apis(RouteDefinitionLocator locator, SwaggerUiConfigProperties swaggerUiConfigProperties) {
        Set<SwaggerUrl> urls = new HashSet<>();
        List<RouteDefinition> definitions = locator.getRouteDefinitions().collectList().block();
        if (definitions == null) {
            return Collections.emptySet();
        }
        definitions.stream().filter(routeDefinition -> routeDefinition.getId().matches(".*-service-impl")).forEach(routeDefinition -> {
            String name = (String) routeDefinition.getMetadata().get("name");
            List<PredicateDefinition> predicates = routeDefinition.getPredicates();
            PredicateDefinition predicateDefinition = predicates.getFirst();
            String pattern = predicateDefinition.getArgs().get("pattern");
            String prefix = pattern.replace("/**", "").replace("/", "");
            SwaggerUrl swaggerUrl = new SwaggerUrl(name, prefix + DEFAULT_API_DOCS_URL, null);
            urls.add(swaggerUrl);
        });
        swaggerUiConfigProperties.setUrls(urls);
        return urls;
    }

}

v-file-service-impl:
application.yml

dubbo:
  application:
    name: ${spring.application.name}
    logger: slf4j
  protocol:
    name: tri
    port: 50053
  registry:
    address: nacos://@nacos.discovery.server-addr@

If I access the file service's api document address (http://localhost:8000/file/v3/api-docs) through the gateway, I will find that success and failure alternate. If I directly use the file service's ip:port to access the document address (http://localhost:11002/v3/api-docs), there will be no error.

success:
image

fail:
image

file-service is a dubbo provider. If you remove all the provider's @ DubboServices, no error will be reported.

image

stacktrace:

2025-01-10 08:26:54.435  INFO 8000 --- [erverWorker-7-1] .r.p.t.h.AbstractServerTransportListener : []  [DUBBO] An error occurred while processing the http request with DefaultHttp11ServerTransportListener, Http1Request{method='GET', path='/v3/api-docs', contentType='null'}, dubbo version: 3.3.2, current host: 172.19.0.1

org.apache.dubbo.remoting.http12.exception.HttpStatusException: Invoker not found
	at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.doRoute(AbstractServerTransportListener.java:128)
	at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onBeforeMetadata(AbstractServerTransportListener.java:122)
	at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onMetadata(AbstractServerTransportListener.java:89)
	at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onMetadata(AbstractServerTransportListener.java:54)
	at org.apache.dubbo.remoting.http12.netty4.h1.NettyHttp1ConnectionHandler.channelRead0(NettyHttp1ConnectionHandler.java:56)
	at org.apache.dubbo.remoting.http12.netty4.h1.NettyHttp1ConnectionHandler.channelRead0(NettyHttp1ConnectionHandler.java:29)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
	at org.apache.dubbo.remoting.http12.netty4.h1.NettyHttp1Codec.channelRead(NettyHttp1Codec.java:49)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.

What you expected to happen

There is no exception when requesting /v3/api-docs

Anything else

I guess the problem is caused by the adaptation of triple protocol to spring, but I am not very familiar with triple protocol. I would like to ask the developer to help me troubleshoot it.

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@L1yp L1yp added component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage
Projects
Status: Todo
Development

No branches or pull requests

1 participant