我有一个无法通过以下错误消息启动的微服务:

2020-03-08T06:55:23.966752513Z ***************************
2020-03-08T06:55:23.966756613Z APPLICATION FAILED TO START
2020-03-08T06:55:23.966771414Z ***************************
2020-03-08T06:55:23.966775614Z
2020-03-08T06:55:23.966779614Z Description:
2020-03-08T06:55:23.966783414Z
2020-03-08T06:55:23.966787415Z An attempt was made to call the method okhttp3.HttpUrl.get(Ljava/lang/String;)Lokhttp3/HttpUrl; but it does not exist. Its class, okhttp3.HttpUrl, is available from the following locations:
2020-03-08T06:55:23.966791915Z
2020-03-08T06:55:23.966795915Z     jar:file:/myapp/myapp.jar!/BOOT-INF/lib/okhttp-3.8.1.jar!/okhttp3/HttpUrl.class
2020-03-08T06:55:23.966865718Z
2020-03-08T06:55:23.966876618Z It was loaded from the following location:
2020-03-08T06:55:23.966880919Z
2020-03-08T06:55:23.966884919Z     jar:file:/myapp/myapp.jar!/BOOT-INF/lib/okhttp-3.8.1.jar!/
2020-03-08T06:55:23.966889119Z
2020-03-08T06:55:23.966892919Z
2020-03-08T06:55:23.966896719Z Action:
2020-03-08T06:55:23.966900719Z
2020-03-08T06:55:23.966904520Z Correct the classpath of your application so that it contains a single, compatible version of okhttp3.HttpUrl
2020-03-08T06:55:23.966918320Z 


我没有直接使用okhttp3,而是使用了两个使用Microsoft keyvault和文档库的库。 Microsoft库正在使用okhttp3库。

另外,该服务在本地启动,但仅在部署到AWS时才看到此问题。

我该如何解决?任何帮助表示赞赏,并在此先感谢。

感谢致敬,
dj

最佳答案

您正在从2个位置加载
mvn依赖项:树
尝试在pom.xml中使用Maven排除项仅获得okhttp3库的一个实例。

10-06 02:14