我正在使用 gemfire 并尝试在我的 Maven 项目中使用 apache geode 加载客户端缓存。创建 ClientCacheFactory 时,我收到 ClassCastException
java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLogger cannot be cast to org.apache.logging.log4j.core.Logger
at org.apache.geode.logging.log4j.internal.impl.Log4jLoggingProvider.getRootLoggerContext(Log4jLoggingProvider.java:105) ~[geode-log4j-9.10.5.jar:na]
at org.apache.geode.logging.log4j.internal.impl.Log4jloggingProvider.getConfiguration (Log4jloggingProvider. java:109) ~[geode-log4j-9.10.5.jar:na]
at org.apache.geode.logging.log4j.internāl.impl.log4jloggingProvider.isUsingGemFireDefaultConfig (Log4jloggingProvider.java:94) ~[geode-log4j-9.10.5.jar:na]
at org.apache.geode.logging.log4j.internal.impl.Log4jloggingProvider.shouldUpdateLoglevels (Log4jloggingProvider.java:143) ~[geode-logj-9.10.5.jar:na]
at org.apache.geode.logging.log4j.internal.impl.log4jloggingProvider.configure (Log4jLoggingProvider.Java:121) "[geode-log4j-9.10.5.jar:na]
at org.apache.geode.logging.internal.Configuration.configChanged (Configuration. Java:143) " [geode-core-9.10.5.jar:na]
at org.apache.geode.logging.internal.Configuration. initialize (Configuration.java:132) " [geode-core-9.10.5.jar:na]
at org.apache.geode.logging.internal.LoggingSession.createSession (LoggingSession.java:69) "[geode-core-9.10.5.jar:na]
at org.apache.geode.distributed.internal.InternalDistributedSystem.initialize (InternalDistributedSystem. java:704) ~[geode-core-9.10.5.jar:na]
at org.apache.geode.distributed.internal. InternalDistributedSystem.access$200 (InternalDistributedSystem. java:135) ~[geode-core-9.10.5.]ar:na
at org.apache.geode.distributed.internal. InternalDistributedSystemșBuilder.build (InternalDistributedSystem. java:3036) ~[geode-core-9.10.5.jar:na]
at org.apache.geode.distributed. internal.InternalDistributedSystem.connectInternal (InternalDistributedSystem.java:290) ~[geode-core-9.10.5.jar:na]
at org.apache.geode.distributed.înternal.InternalDistributedSystem.connectInternal (InternalDistributedsystem. java:216) ~[geode-core-9.10.5.jar:na]
at org.apache.geode.cache.client.ClientCacheFactory.connectInternalDistributedSystem (ClientCacheFactory. java:280) ~ [geode-core-9.10.5.jar:na]
at org.apache.geode.cache.client.ClientCacheFactory.basicCreate (ClientCacheFactory.java:250) - [geode-core-9.10.5.jar:na]
at org.apache.geode.cache.client.ClientCacheFactory.create (ClientCacheFactory. java:216) "[geode-core-9.10.5.jar:na]
.....
我尝试删除 log4j-over-slf4j、log4j-api 和 log4j-core 并尝试添加 slf4j-log4j12 但仍然遇到此异常。现在我知道 geode-core 内部包含 log4j,因此我也排除了 log4j 和 log4j-to-slf4j 依赖项。但问题仍然存在。如果我能得到一些重新分级异常的指示,那将非常有帮助。
目前我有以下依赖项: 1.log4j-slf4j-impl 2.log4j-api 3.log4j-核心 4.log4j-over-slf4j 5.slf4j-api 6.slf4j-log4j12
我正在使用 geode-core-9.10.5,同时还包含 geode-log4j 和 geode-logging。
对于将来可能遇到此问题的任何人来说,这是由于 geode-log4j jar 造成的。我有另一个文件夹,我在项目中添加 slf4j jars。由于技术原因,我不允许删除这些。一旦我删除了 jar,这个异常就消失了。