Debugging Dubbo‑Spring Cloud Integration with Arthas: Solving Mixed Protocol Issues

Faced with a legacy Dubbo service needing both Dubbo and HTTP protocols and a new Spring Cloud project requiring seamless Feign calls, this article details the challenges, the solution using Dubbo’s SPI Container extension, and how Arthas was employed to diagnose and resolve hidden loading errors.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Debugging Dubbo‑Spring Cloud Integration with Arthas: Solving Mixed Protocol Issues

Usage Background

In a large team, different projects use different RPC frameworks: an older project uses Dubbo with the Dubbo protocol, while a newer project uses Spring Cloud’s Feign client with HTTP. This creates two problems: the Dubbo service must support both Dubbo and HTTP protocols, and Feign clients must call the Dubbo service’s HTTP endpoint without losing dynamic service discovery or load‑balancing capabilities.

Solution Idea

The first problem is straightforward because Dubbo already provides an HTTP protocol exposure; configuring Dubbo to expose both protocols solves it. The second problem is trickier: Dubbo registers with Zookeeper, while Spring Cloud uses Eureka. Feign can call any HTTP interface, but it lacks built‑in load‑balancing and failover for the Dubbo‑exposed HTTP endpoint. The proposed approach is to register Dubbo services in Eureka so that Feign can invoke them losslessly.

To achieve this, the Dubbo project adds an SPI Container extension that registers the service with Eureka. The custom container class is defined as follows:

class EurekaDubboContainer implements Container { ... }

The container must be declared in META‑INF/dubbo/org.apache.dubbo.container.Container, e.g.

META-INF/dubbo/org.apache.dubbo.container.Container: spring=com.xxx.EurekaDubboContainer

Arthas in Action

After adding the container and restarting, the service starts without errors, but Feign still cannot call it. Using Arthas, the author inspected the Dubbo extension loading process. The investigation revealed that the custom container class was loaded (verified with sc -d *.EurekaDubboContainer and jad *.EurekaDubboContainer), but it was not present in Dubbo’s ExtensionLoader cached instances. Further Ognl queries showed the container was missing from the cached instances and listed in the loader’s exceptions, indicating a duplicate key in META‑INF.

Arthas Ognl inspection result
Arthas Ognl inspection result

Correcting the duplicate key resolved the loading issue, allowing the Dubbo service to register with Eureka and be called by Feign without loss.

Conclusion

The experience shows that seemingly unsolvable integration problems can be addressed by extending Dubbo’s SPI mechanism and using Arthas for deep runtime inspection. By registering Dubbo services in Eureka, both protocols coexist, and Feign clients gain proper load‑balancing and failover. The article encourages developers to explore Arthas’s Ognl capabilities for diagnosing hidden extension loading problems.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingJavaDubbofeigneurekaSpring CloudArthas
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.