gpt4 book ai didi

java - 类加载器问题。同一个 jar 中的子类是 'not a subtype'

转载 作者:行者123 更新时间:2023-11-30 06:08:06 25 4
gpt4 key购买 nike

从同一个 log4j-api-2.10.0.jar 加载的 EnvironmentPropertySource 怎么可能不是 PropertySource 的子类型?

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/opt/cloudera/parcels/CDH-5.10.1-1.cdh5.10.1.p0.10/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[Loaded org.slf4j.spi.LoggerFactoryBinder from file:/app/opt/cloudera/parcels/CDH-5.10.1-1.cdh5.10.1.p0.10/jars/slf4j-api-1.7.5.jar]
[Loaded org.slf4j.impl.StaticLoggerBinder from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-slf4j-impl-2.10.0.jar]
[Loaded org.apache.logging.log4j.spi.LoggerAdapter from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.spi.AbstractLoggerAdapter from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.slf4j.Log4jLoggerFactory from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-slf4j-impl-2.10.0.jar]
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
[Loaded org.apache.logging.log4j.util.StackLocatorUtil from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.StackLocator from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.LoaderUtil from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.LoaderUtil$ThreadContextClassLoaderGetter from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertiesUtil from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertySource from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertiesUtil$Environment from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.BiConsumer from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertiesPropertySource from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertyFilePropertySource from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertySource$Comparator from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.PropertySource from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded org.apache.logging.log4j.util.EnvironmentPropertySource from file:/home/extproc/WMA/bmss/bmss-dev/producer/lib/log4j-api-2.10.0.jar]
[Loaded java.util.ServiceConfigurationError from /usr/lib/jvm/java-1.8.0-oracle-1.8.0.151.x86_64/jre/lib/rt.jar]
Exception in thread "main" [Loaded java.lang.Throwable$PrintStreamOrWriter from /usr/lib/jvm/java-1.8.0-oracle-1.8.0.151.x86_64/jre/lib/rt.jar]
[Loaded java.lang.Throwable$WrappedPrintStream from /usr/lib/jvm/java-1.8.0-oracle-1.8.0.151.x86_64/jre/lib/rt.jar]
[Loaded java.util.IdentityHashMap$KeySet from /usr/lib/jvm/java-1.8.0-oracle-1.8.0.151.x86_64/jre/lib/rt.jar]
java.util.ServiceConfigurationError: org.apache.logging.log4j.util.PropertySource: Provider org.apache.logging.log4j.util.EnvironmentPropertySource not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.apache.logging.log4j.util.PropertiesUtil$Environment.<init>(PropertiesUtil.java:319)
at org.apache.logging.log4j.util.PropertiesUtil$Environment.<init>(PropertiesUtil.java:310)
at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:69)
at org.apache.logging.log4j.util.PropertiesUtil.<clinit>(PropertiesUtil.java:49)
at org.apache.logging.log4j.util.LoaderUtil.isIgnoreTccl(LoaderUtil.java:256)
at org.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:159)
at org.apache.logging.log4j.util.StackLocator.<clinit>(StackLocator.java:65)
at org.apache.logging.log4j.util.StackLocatorUtil.<clinit>(StackLocatorUtil.java:28)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at com.company.producer.BmssProducerApp.<clinit>(BmssProducerApp.java:42)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.spark.util.Utils$.classForName(Utils.scala:229)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:695)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:187)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:212)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:126)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

最佳答案

首先,检查同一个 jar 是否有多个版本。

其次,如果您使用的是 IDE,请清除缓存并再次清理并构建您的项目。

关于java - 类加载器问题。同一个 jar 中的子类是 'not a subtype',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50855885/

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