java.lang.NoSuchFieldError: INSTANCE at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.initializeCommon

java.lang.NoSuchFieldError: INSTANCE at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.initializeCommon

我最近将项目使用的Keycloak客户端库更新到了14.0.0版本。我的测试失败了,原因如下:

[ERROR] Caused by: java.lang.NoSuchFieldError: INSTANCE
[ERROR]         at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.initializeCommon(ResteasyProviderFactoryImpl.java:225)
[ERROR]         at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.initialize(ResteasyProviderFactoryImpl.java:262)
[ERROR]         at org.jboss.resteasy.spi.ResteasyProviderFactory.<init>(ResteasyProviderFactory.java:301)
[ERROR]         at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.<init>(ResteasyProviderFactoryImpl.java:169)
[ERROR]         at org.jboss.resteasy.client.jaxrs.internal.LocalResteasyProviderFactory.<init>(LocalResteasyProviderFactory.java:26)
[ERROR]         at com.acme.apollo.idm.idmneo.KeycloakFactory.getClientBuilder(KeycloakFactory.java:177)
[ERROR]         at com.acme.apollo.idm.idmneo.KeycloakFactory.getMasterRealmKeycloak(KeycloakFactory.java:50)
[ERROR]         at com.acme.verity.qa.tests.TestNextCreateWorkspaceWithExportUser.<clinit>(TestNextCreateWorkspaceWithExportUser.java:50)
[ERROR]         at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR]         at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[ERROR]         at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:23)
[ERROR]         at org.testng.internal.InstanceCreator.instantiateUsingDefaultConstructor(InstanceCreator.java:193)
[ERROR]         at org.testng

好像和这个问题类似:

https://github.com/oracle/oci-java-sdk/issues/240

这表明问题可能是由于库冲突造成的,我只是不确定是哪一个?这是 mvn dependency:tree:

的输出
[INFO] groupId:SCM-Auto:jar:1.0-SNAPSHOT
[INFO] +- com.vertica:vertica-jdbc:jar:7.1.1-0:compile
[INFO] +- ATUReporterlibs:ATUReporter_Selenium_testNG_5.5_BETA:jar:5.5_BETA:compile
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.testng:testng:jar:7.4.0:compile
[INFO] |  \- org.webjars:jquery:jar:3.5.1:compile
[INFO] +- org.xerial:sqlite-jdbc:jar:3.8.7:compile
[INFO] +- org.seleniumhq.selenium:selenium-server:jar:2.48.1:compile
[INFO] |  +- org.bouncycastle:bcprov-jdk15on:jar:1.48:compile
[INFO] |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.48:compile
[INFO] |  +- mx4j:mx4j-tools:jar:3.0.1:compile
[INFO] |  +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.9:compile
[INFO] |  +- org.seleniumhq.selenium:jetty-repacked:jar:9.2.13.v20150730:compile
[INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] |  +- org.seleniumhq.selenium:jetty-rc-repacked:jar:5:compile
[INFO] |  +- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-java:jar:2.48.1:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.48.1:compile
[INFO] |  |  |  \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.48.1:compile
[INFO] |  |  |     +- cglib:cglib-nodep:jar:2.1_3:compile
[INFO] |  |  |     \- org.seleniumhq.selenium:selenium-api:jar:2.48.1:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-edge-driver:jar:2.48.1:compile
[INFO] |  |  |  \- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.48.1:compile
[INFO] |  |  |  \- net.sourceforge.htmlunit:htmlunit:jar:2.18:compile
[INFO] |  |  |     +- xalan:xalan:jar:2.7.2:compile
[INFO] |  |  |     |  \- xalan:serializer:jar:2.7.2:compile
[INFO] |  |  |     +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |  |     +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:compile
[INFO] |  |  |     +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] |  |  |     +- net.sourceforge.nekohtml:nekohtml:jar:1.9.22:compile
[INFO] |  |  |     +- net.sourceforge.cssparser:cssparser:jar:0.9.16:compile
[INFO] |  |  |     |  \- org.w3c.css:sac:jar:1.3:compile
[INFO] |  |  |     \- org.eclipse.jetty.websocket:websocket-client:jar:9.2.12.v20150709:compile
[INFO] |  |  |        +- org.eclipse.jetty:jetty-io:jar:9.2.12.v20150709:compile
[INFO] |  |  |        \- org.eclipse.jetty.websocket:websocket-common:jar:9.2.12.v20150709:compile
[INFO] |  |  |           \- org.eclipse.jetty.websocket:websocket-api:jar:9.2.12.v20150709:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.48.1:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.48.1:compile
[INFO] |  |  |  +- net.java.dev.jna:jna:jar:4.1.0:compile
[INFO] |  |  |  \- net.java.dev.jna:jna-platform:jar:4.1.0:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.48.1:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-support:jar:2.48.1:compile
[INFO] |  |  +- org.webbitserver:webbit:jar:0.4.14:compile
[INFO] |  |  |  \- io.netty:netty:jar:3.5.2.Final:compile
[INFO] |  |  \- org.seleniumhq.selenium:selenium-leg-rc:jar:2.48.1:compile
[INFO] |  +- org.yaml:snakeyaml:jar:1.8:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- com.jayway.restassured:rest-assured:jar:2.6.0:compile
[INFO] |  +- org.codehaus.groovy:groovy:jar:2.4.4:compile
[INFO] |  +- org.codehaus.groovy:groovy-xml:jar:2.4.4:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.1:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.1:compile
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] |  +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
[INFO] |  +- com.jayway.restassured:json-path:jar:2.6.0:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-json:jar:2.4.4:compile
[INFO] |  |  \- com.jayway.restassured:rest-assured-common:jar:2.6.0:compile
[INFO] |  \- com.jayway.restassured:xml-path:jar:2.6.0:compile
[INFO] +- org.postgresql:postgresql:jar:9.4.1207.jre7:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.3:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] |  \- junit:junit:jar:4.10:compile
[INFO] +- org.json:json:jar:20140107:compile
[INFO] +- com.beust:jcommander:jar:1.48:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.3:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.apache.poi:poi:jar:3.12:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.8:compile
[INFO] |  +- org.apache.poi:poi-ooxml-schemas:jar:3.8:compile
[INFO] |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |     \- stax:stax-api:jar:1.0.1:compile
[INFO] |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- com.acme.aspen:aspen-sdk:jar:1.5.0:compile
[INFO] |  +- com.acme.aspen:common-entities:jar:1.5.0:compile
[INFO] |  |  +- io.dropwizard:dropwizard-hibernate:jar:0.8.1:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-db:jar:0.8.1:compile
[INFO] |  |  |  |  \- org.apache.tomcat:tomcat-jdbc:jar:8.0.18:compile
[INFO] |  |  |  |     \- org.apache.tomcat:tomcat-juli:jar:8.0.18:compile
[INFO] |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:jar:2.5.1:compile
[INFO] |  |  |  +- org.jadira.usertype:usertype.core:jar:3.2.0.GA:compile
[INFO] |  |  |  |  \- org.jadira.usertype:usertype.spi:jar:3.2.0.GA:compile
[INFO] |  |  |  \- org.hibernate:hibernate-core:jar:4.3.5.Final:compile
[INFO] |  |  |     +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  |  |     +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  |  |     +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
[INFO] |  |  |     +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  |     +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  |     \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] |  |  +- com.acme.aspen:app-resources-lib:jar:1.5.0:compile
[INFO] |  |  \- org.keycloak:keycloak-jetty92-adapter:jar:1.9.2.Final:compile
[INFO] |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.5.3:compile
[INFO] |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.5.3:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.5.3:compile
[INFO] |  +- javax.mail:mail:jar:1.4:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- com.sun.jersey:jersey-client:jar:1.19:compile
[INFO] |  |  \- com.sun.jersey:jersey-core:jar:1.19:compile
[INFO] |  +- com.sun.jersey.contribs:jersey-multipart:jar:1.19:compile
[INFO] |  |  \- org.jvnet.mimepull:mimepull:jar:1.9.3:compile
[INFO] |  \acme.aspen:aspen-utils:jar:1.5.0:compile
[INFO] |     \- javax.inject:javax.inject:jar:1:compile
[INFO] +- ISTF:ISTFCore:jar:1.0:compile
[INFO] +- commons-net:commons-net:jar:3.5:compile
[INFO] +- com.acme.aspen:idm-lib:jar:2.0.0-SNAPSHOT:compile
[INFO] |  +- io.dropwizard:dropwizard-client:jar:1.0.7:compile
[INFO] |  |  +- io.dropwizard:dropwizard-core:jar:1.0.7:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-util:jar:1.0.7:compile
[INFO] |  |  |  |  +- com.google.code.findbugs:jsr305:jar:3.0.1:compile
[INFO] |  |  |  |  \- joda-time:joda-time:jar:2.9.4:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-jackson:jar:1.0.7:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.7.8:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.7.8:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.7.8:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.7.8:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.7.8:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-validation:jar:1.0.7:compile
[INFO] |  |  |  |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  |  |  |  |  \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] |  |  |  |  \- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-configuration:jar:1.0.7:compile
[INFO] |  |  |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.7.8:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-logging:jar:1.0.7:compile
[INFO] |  |  |  |  +- io.dropwizard.metrics:metrics-logback:jar:3.1.4:compile
[INFO] |  |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] |  |  |  |  +- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  |  |  |  \- org.eclipse.jetty:jetty-util:jar:9.3.9.v20160517:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-metrics:jar:1.0.7:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-jersey:jar:1.0.7:compile
[INFO] |  |  |  |  +- org.glassfish.jersey.core:jersey-server:jar:2.23.2:compile
[INFO] |  |  |  |  |  \- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.23.2:compile
[INFO] |  |  |  |  +- org.glassfish.jersey.ext:jersey-metainf-services:jar:2.23.2:compile
[INFO] |  |  |  |  +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.23.2:compile
[INFO] |  |  |  |  +- io.dropwizard.metrics:metrics-jersey2:jar:3.1.4:compile
[INFO] |  |  |  |  +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.23.2:compile
[INFO] |  |  |  |  |  \- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.23.2:compile
[INFO] |  |  |  |  +- org.eclipse.jetty:jetty-server:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  +- org.eclipse.jetty:jetty-webapp:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  |  \- org.eclipse.jetty:jetty-xml:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  \- org.eclipse.jetty:jetty-continuation:jar:9.3.9.v20160517:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-servlets:jar:1.0.7:compile
[INFO] |  |  |  |  \- io.dropwizard.metrics:metrics-annotation:jar:3.1.4:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-jetty:jar:1.0.7:compile
[INFO] |  |  |  |  +- io.dropwizard.metrics:metrics-jetty9:jar:3.1.4:compile
[INFO] |  |  |  |  +- org.eclipse.jetty:jetty-servlet:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  |  \- org.eclipse.jetty:jetty-security:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  +- org.eclipse.jetty:jetty-servlets:jar:9.3.9.v20160517:compile
[INFO] |  |  |  |  \- org.eclipse.jetty:jetty-http:jar:9.3.9.v20160517:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-lifecycle:jar:1.0.7:compile
[INFO] |  |  |  +- io.dropwizard.metrics:metrics-core:jar:3.1.4:compile
[INFO] |  |  |  +- io.dropwizard.metrics:metrics-jvm:jar:3.1.4:compile
[INFO] |  |  |  +- io.dropwizard.metrics:metrics-servlets:jar:3.1.4:compile
[INFO] |  |  |  |  \- io.dropwizard.metrics:metrics-json:jar:3.1.4:compile
[INFO] |  |  |  +- io.dropwizard.metrics:metrics-healthchecks:jar:3.1.4:compile
[INFO] |  |  |  +- io.dropwizard:dropwizard-request-logging:jar:1.0.7:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-access:jar:1.1.7:compile
[INFO] |  |  |  +- net.sourceforge.argparse4j:argparse4j:jar:0.7.0:compile
[INFO] |  |  |  \- org.eclipse.jetty.toolchain.setuid:jetty-setuid-java:jar:1.0.3:compile
[INFO] |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.23.2:compile
[INFO] |  |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] |  |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.23.2:compile
[INFO] |  |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.23.2:compile
[INFO] |  |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] |  |  |  +- org.glassfish.hk2:hk2-api:jar:2.5.0-b05:compile
[INFO] |  |  |  |  +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b05:compile
[INFO] |  |  |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b05:compile
[INFO] |  |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b05:compile
[INFO] |  |  |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b05:compile
[INFO] |  |  +- io.dropwizard.metrics:metrics-httpclient:jar:3.1.4:compile
[INFO] |  |  \- org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.23.2:compile
[INFO] |  +- org.keycloak:keycloak-jetty93-adapter:jar:4.0.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] |  |  +- org.keycloak:keycloak-adapter-core:jar:4.0.0.Final:compile
[INFO] |  |  \- org.keycloak:keycloak-jetty-core:jar:4.0.0.Final:compile
[INFO] |  |     +- org.keycloak:keycloak-adapter-spi:jar:4.0.0.Final:compile
[INFO] |  |     \- org.keycloak:keycloak-jetty-adapter-spi:jar:4.0.0.Final:compile
[INFO] |  \- com.wordnik:swagger-jaxrs_2.10:jar:1.3.13:compile
[INFO] |     +- org.scala-lang:scala-library:jar:2.10.4:compile
[INFO] |     +- com.wordnik:swagger-core_2.10:jar:1.3.13:compile
[INFO] |     |  +- com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.4.1:compile
[INFO] |     |  |  +- org.scala-lang:scala-reflect:jar:2.10.4:compile
[INFO] |     |  |  \- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
[INFO] |     |  +- com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.4.1:compile
[INFO] |     |  +- com.wordnik:swagger-annotations:jar:1.3.13:compile
[INFO] |     |  +- org.json4s:json4s-ext_2.10:jar:3.2.11:compile
[INFO] |     |  |  \- org.joda:joda-convert:jar:1.6:compile
[INFO] |     |  +- org.json4s:json4s-native_2.10:jar:3.2.11:compile
[INFO] |     |  |  \- org.json4s:json4s-core_2.10:jar:3.2.11:compile
[INFO] |     |  |     +- org.json4s:json4s-ast_2.10:jar:3.2.11:compile
[INFO] |     |  |     \- org.scala-lang:scalap:jar:2.10.0:compile
[INFO] |     |  |        \- org.scala-lang:scala-compiler:jar:2.10.0:compile
[INFO] |     |  \- org.json4s:json4s-jackson_2.10:jar:3.2.11:compile
[INFO] |     \- org.reflections:reflections:jar:0.9.9:compile
[INFO] |        +- org.javassist:javassist:jar:3.18.2-GA:compile
[INFO] |        \- com.google.code.findbugs:annotations:jar:2.0.1:compile
[INFO] +- com.mesosphere:marathon-client:jar:0.6.0:compile
[INFO] |  +- com.netflix.feign:feign-core:jar:8.18.0:compile
[INFO] |  |  \- org.jvnet:animal-sniffer-annotation:jar:1.0:runtime
[INFO] |  +- com.netflix.feign:feign-gson:jar:8.18.0:compile
[INFO] |  +- com.netflix.feign:feign-slf4j:jar:8.18.0:compile
[INFO] |  +- org.slf4j:slf4j-simple:jar:1.7.13:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.5:compile
[INFO] |  +- com.google.guava:guava:jar:20.0:compile
[INFO] |  +- net.oauth.core:oauth:jar:20100527:compile
[INFO] |  \- com.nimbusds:nimbus-jose-jwt:jar:4.23:compile
[INFO] |     +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |     \- net.minidev:json-smart:jar:1.3.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
[INFO] |  |  +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:1.0.1.Final:compile
[INFO] |  |  +- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] |  |  +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  |  +- com.ibm.async:asyncutil:jar:0.1.0:compile
[INFO] |  |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec:jar:2.0.1.Final:compile
[INFO] |  |  +- com.sun.activation:jakarta.activation:jar:1.2.1:compile
[INFO] |  |  \- io.smallrye.config:smallrye-config:jar:2.0.1:compile
[INFO] |  |     \- io.smallrye.config:smallrye-config-core:jar:2.0.1:compile
[INFO] |  |        +- org.eclipse.microprofile.config:microprofile-config-api:jar:2.0:compile
[INFO] |  |        +- io.smallrye.common:smallrye-common-annotation:jar:1.5.0:compile
[INFO] |  |        +- io.smallrye.common:smallrye-common-expression:jar:1.5.0:compile
[INFO] |  |        |  \- io.smallrye.common:smallrye-common-function:jar:1.5.0:compile
[INFO] |  |        +- io.smallrye.common:smallrye-common-constraint:jar:1.5.0:compile
[INFO] |  |        +- io.smallrye.common:smallrye-common-classloader:jar:1.5.0:compile
[INFO] |  |        +- org.ow2.asm:asm:jar:9.0:compile
[INFO] |  |        \- io.smallrye.config:smallrye-config-common:jar:2.0.1:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core-spi:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-jackson2-provider:jar:4.6.0.Final:compile
[INFO] |  |  \- com.github.java-json-tools:json-patch:jar:1.13:compile
[INFO] |  |     +- com.github.java-json-tools:msg-simple:jar:1.2:compile
[INFO] |  |     |  \- com.github.java-json-tools:btf:jar:1.3:compile
[INFO] |  |     \- com.github.java-json-tools:jackson-coreutils:jar:2.0:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.14:compile
[INFO] |  +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:jar:2.0.1.Final:compile
[INFO] |  +- org.keycloak:keycloak-core:jar:14.0.0:compile
[INFO] |  \- org.keycloak:keycloak-common:jar:14.0.0:compile
[INFO] +- com.microsoft.sqlserver:mssql-jdbc:jar:7.4.1.jre8:compile
[INFO] \- org.samba.jcifs:jcifs:jar:1.3.3:compile

pom.xml(仅依赖部分):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    ...

    <dependencies>
        <dependency>
            <groupId>com.vertica</groupId>
            <artifactId>vertica-jdbc</artifactId>
            <version>7.1.1-0</version>
        </dependency>
        <dependency>
            <groupId>ATUReporterlibs</groupId>
            <artifactId>ATUReporter_Selenium_testNG_5.5_BETA</artifactId>
            <version>5.5_BETA</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.8.7</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.48.1</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>2.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.4.1207.jre7</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.7</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.7</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.8.3</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20140107</version>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <version>1.48</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.12.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.12.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.12.3</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.12</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.8</version>
            <exclusions>
                <exclusion>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.acme.aspen</groupId>
            <artifactId>aspen-sdk</artifactId>
            <version>1.5.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.acme.caf</groupId>
                    <artifactId>storage-sdk</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>ISTF</groupId>
            <artifactId>ISTFCore</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.5</version>
        </dependency>
        <dependency>
            <groupId>com.acme.aspen</groupId>
            <artifactId>idm-lib</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.glassfish.jersey.core</groupId>
                    <artifactId>jersey-server</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.mesosphere</groupId>
            <artifactId>marathon-client</artifactId>
            <version>0.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>com.acme.apollo.idm</groupId>
            <artifactId>idm-neo</artifactId>
            <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>7.4.1.jre8</version>
        </dependency>
        <dependency>
            <groupId>org.samba.jcifs</groupId>
            <artifactId>jcifs</artifactId>
            <version>1.3.3</version>
        </dependency>
    </dependencies>
</project>

该问题的评论之一:

https://github.com/oracle/oci-java-sdk/issues/240#issuecomment-677885509

提到他们能够通过排除 jersey-server 依赖项来修复 resteasy 错误。我也试过了,但编译后仍然出现同样的错误,运行 再次测试:

<dependency>
    <groupId>com.acme.aspen</groupId>
    <artifactId>idm-lib</artifactId>
    <version>2.0.0-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-server</artifactId>
        </exclusion>
    </exclusions>
</dependency>

确实,您的项目中的 RestEasy(传递)依赖项存在冲突:

[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile

您的显式依赖关系很好,但是 com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT 有一个问题 - 它显式地依赖于 resteasy-core:jar:4.6.0.Final,并且通过 org.keycloak:keycloak-admin-client:jar:14.0.0

依赖于 org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>

这两个 jar 是二进制不兼容的。

resteasy-core:jar:4.6.0.Final 罐子里 ResteasyProviderFactoryImpl expects to see a field called INSTANCE in class MediaTypeHeaderDelegate which is part of the same jar.

      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

然而 org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final 也有 MediaTypeHeaderDelegate class 其中 doesn't have INSTANCE field - 因此你的错误。

如果您无法控制该依赖性,您可以尝试使用 excludes:

修复它
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>

或者您可以尝试使用 dependencyManagement 部分来执行 RestEasy 版本:

<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>