apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.4k stars 26.42k forks source link

dubbo2.6.5 not work with spring-boot-2.1.x #3543

Closed morisenmen closed 3 years ago

morisenmen commented 5 years ago

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

nacos-spring-boot-starter:0.2.1 spring-boot-starter:2.1.x dubbo:2.6.5

Expected Result

This problem is that spring-boot-2.1.x use tomcat-embed 9.x.And in that version has no Connector.setProtocol in it.

this is the error message:
An attempt was made to call the method org.apache.catalina.connector.Connector.setProtocol(Ljava/lang/String;)V but it does not exist. Its class, org.apache.catalina.connector.Connector, is available from the following locations:
Zzij commented 5 years ago

i have the same problem

morisenmen commented 5 years ago

java.lang.NoSuchMethodError: org.apache.catalina.connector.Connector.setProtocol(Ljava/lang/String;)V

at com.alibaba.dubbo.remoting.http.tomcat.TomcatHttpServer.(TomcatHttpServer.java:63) at com.alibaba.dubbo.remoting.http.tomcat.TomcatHttpBinder.bind(TomcatHttpBinder.java:28) at com.alibaba.dubbo.remoting.http.HttpBinder$Adaptive.bind(HttpBinder$Adaptive.java)

morisenmen commented 4 years ago

In TomcatHttpServer. The Code is not compatible could fix with this way

//        tomcat.getConnector().setProtocol("org.apache.coyote.http11.Http11NioProtocol");

        Context context = tomcat.addContext("/", baseDir);
        Tomcat.addServlet(context, "dispatcher", new DispatcherServlet());
        context.addServletMappingDecoded("/*", "dispatcher");

Protoco org.apache.coyote.http11.Http11NioProtocol in tomcat 9.This is default config,so it is not necessary.And ServletMapping set method is addServletMappingDecoded.

AlbumenJ commented 3 years ago

Please try upgrade to Dubbo 2.7.