gpt4 book ai didi

java.lang.LinkageError : Package versions: jackson-core=2. 13.3、 jackson -databind=2.13.3、 jackson -dataformat-xml=2.13.3、 jackson -datatype-jsr310=2.13.3

转载 作者:行者123 更新时间:2023-12-02 23:55:05 28 4
gpt4 key购买 nike

我试图在我的应用程序中从azure实现keyvault,在为DefaultAzureCredentialBuilder()实现azure-identity:1.5.4 lib后,它会抛出链接错误,如下所示,我还强制使用特定版本并排除了其中一些,但仍然存在同样的问题,请建议我如何检测以前的版本或冲突版本以便删除。而且我的编译 sdk 版本是 32。更新了下面的 Gradle 依赖项。我用过

resolutlionStrategy { failOnVersionConflict()}

但现在显示没有冲突。

java.lang.LinkageError: Package versions: jackson-core=2.13.3, jackson-databind=2.13.3, jackson-dataformat-xml=2.13.3, jackson-datatype-jsr310=2.13.3, azure-core=1.31.0, Troubleshooting version conflicts: 
at com.azure.core.implementation.jackson.ObjectMapperShim.createXmlMapper(ObjectMapperShim.java:82)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:82)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:59)
at com.azure.core.util.serializer.JacksonAdapter$SerializerAdapterHolder.<clinit>(JacksonAdapter.java:114)
at com.azure.core.util.serializer.JacksonAdapter$SerializerAdapterHolder.access$000(JacksonAdapter.java:110)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.NoSuchMethodError: No static method newFactory(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLInputFactory; in class Ljavax/xml/stream/XMLInputFactory; or its super classes (declaration of 'javax.xml.stream.XMLInputFactory' appears in /data/app/~~sFZqRHFT2xtp6Ogx--
at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:115)
at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:101)
at com.fasterxml.jackson.dataformat.xml.XmlFactory.<init>(XmlFactory.java:85)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:127)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.builder(XmlMapper.java:218)
at com.azure.core.implementation.jackson.ObjectMapperFactory.createXmlMapper(ObjectMapperFactory.java:90)

Gradle 依赖

     implementation("com.azure:azure-sdk-bom:1.2.5"){
force(true)
}
implementation ('com.fasterxml.jackson.core:jackson-core'){
version{
strictly("2.13.4")
}
force(true)
}
implementation ('com.fasterxml.jackson.core:jackson-databind:2.13.4'){
force(true)
version{
strictly("2.13.4")
}
}
implementation ('com.fasterxml.jackson.dataformat:jackson-dataformat-xml'){
version{
strictly("2.13.4")
}
force(true)
}

implementation ('com.fasterxml.jackson.core:jackson-annotations:2.13.4'){
version{
strictly("2.13.4")
}
force(true)
}

implementation ('com.fasterxml.jackson.datatype:jackson-datatype-jsr310'){
version{
strictly("2.13.4")
}
force(true)
}
//azure keyvault lib
implementation ('com.azure:azure-core'){
version{
strictly("1.32.0")
}
force(true)
}
implementation ('com.azure:azure-security-keyvault-keys:4.4.6')
implementation 'com.azure:azure-security-keyvault-secrets:4.4.6'
implementation (group: 'com.microsoft.azure', name: 'azure-storage', version: '8.6.6')
implementation (group: 'com.azure', name: 'azure-storage-blob', version: '12.19.0')

implementation("com.azure:azure-core-http-netty:1.12.5"){
force(true)
force = true
}
implementation("com.microsoft.azure:msal4j:1.13.0"){
force(true)
}
implementation("com.microsoft.azure:msal4j-persistence-extension:1.1.0"){
force(true)
}
implementation group: 'javax.xml.stream', name: 'stax-api', version: '1.0-2'

implementation ('com.google.guava:guava:27.0.1-android'){
force(true)
force = true
}

implementation ('com.azure:azure-identity'){
version{
strictly("1.5.5")
}
exclude group: 'com.azure', module: 'azure-core'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-xml'
exclude group: 'com.fasterxml.jackson.datatype', module: 'jackson-datatype-jsr353'
}

最佳答案

如果依赖项列表中有多个 Jackson 版本,则会发生错误。

Azure SDK 库在各个版本中积极更新 Jackson 版本。如果有不同版本的库,势必会产生冲突。 (尽管 Azure SDK 在 Jackson 2.10+ 上被设置为 compatible)

这就是 Azure-SDK 发布 bom 的原因。这些 Artifact 经过严格测试,以确保不同 Azure 库之间的兼容性。

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-sdk-bom</artifactId>
<version>1.2.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>com.azure:azure-security-keyvault-keys</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-communication-chat</artifactId>
</dependency>

</dependencies>

关于java.lang.LinkageError : Package versions: jackson-core=2. 13.3、 jackson -databind=2.13.3、 jackson -dataformat-xml=2.13.3、 jackson -datatype-jsr310=2.13.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73578723/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com