Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memcached implementaion broken due to log4j update #1414

Closed
holajsh opened this issue Jun 10, 2022 · 1 comment · Fixed by #1411
Closed

Memcached implementaion broken due to log4j update #1414

holajsh opened this issue Jun 10, 2022 · 1 comment · Fixed by #1411
Labels
Milestone

Comments

@holajsh
Copy link
Contributor

holajsh commented Jun 10, 2022

Play Version (1.5.x / etc)

1.7.0

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Linux 5.14.0-1038-oem #42-Ubuntu SMP Thu May 19 05:03:08 UTC 2022 x86_64 GNU/Linux

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-post-Debian-1deb10u1, mixed mode, sharing)

Actual Behavior

When enabling memcached support, the library initialization fails with the following exception:

13:02:21.345 [main] ERROR play - Error while connecting to memcached
java.lang.RuntimeException: Problem getting logger
        at net.spy.memcached.compat.log.LoggerFactory.internalGetLogger(LoggerFactory.java:100) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.log.LoggerFactory.getLogger(LoggerFactory.java:87) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.log.LoggerFactory.getLogger(LoggerFactory.java:73) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.SpyThread.getLogger(SpyThread.java:60) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.MemcachedConnection.<init>(MemcachedConnection.java:294) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.DefaultConnectionFactory.createConnection(DefaultConnectionFactory.java:209) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:209) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:179) ~[spymemcached-2.12.3.jar:2.12.3]
        at play.cache.MemcachedImpl.initClient(MemcachedImpl.java:127) ~[play-1.7.1.jar:?]
        at play.cache.MemcachedImpl.<init>(MemcachedImpl.java:89) ~[play-1.7.1.jar:?]
        at play.cache.MemcachedImpl.getInstance(MemcachedImpl.java:46) ~[play-1.7.1.jar:?]
        at play.cache.Cache.init(Cache.java:235) ~[play-1.7.1.jar:?]
        at play.Play.start(Play.java:549) ~[play-1.7.1.jar:?]
        at play.Play.init(Play.java:326) ~[play-1.7.1.jar:?]
        at play.server.Server.main(Server.java:164) ~[play-1.7.1.jar:?]
Caused by: java.lang.reflect.InvocationTargetException
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at net.spy.memcached.compat.log.LoggerFactory.getNewInstance(LoggerFactory.java:118) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.log.LoggerFactory.internalGetLogger(LoggerFactory.java:98) ~[spymemcached-2.12.3.jar:2.12.3]
        ... 14 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at net.spy.memcached.compat.log.Log4JLogger.<init>(Log4JLogger.java:45) ~[spymemcached-2.12.3.jar:2.12.3]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at net.spy.memcached.compat.log.LoggerFactory.getNewInstance(LoggerFactory.java:118) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.log.LoggerFactory.internalGetLogger(LoggerFactory.java:98) ~[spymemcached-2.12.3.jar:2.12.3]
        ... 14 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
        at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[?:?]
        at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
        at net.spy.memcached.compat.log.Log4JLogger.<init>(Log4JLogger.java:45) ~[spymemcached-2.12.3.jar:2.12.3]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at net.spy.memcached.compat.log.LoggerFactory.getNewInstance(LoggerFactory.java:118) ~[spymemcached-2.12.3.jar:2.12.3]
        at net.spy.memcached.compat.log.LoggerFactory.internalGetLogger(LoggerFactory.java:98) ~[spymemcached-2.12.3.jar:2.12.3]
        ... 14 more
13:02:21.351 [main] WARN  play - Fallback to local cache

It seems due to the update to log4j 2.x where org/apache/log4j/Logger does not exists anymore.

holajsh added a commit to holajsh/play1 that referenced this issue Jun 10, 2022
…r Memcached client library as it is not compatible with log4j 2.x
@holajsh
Copy link
Contributor Author

holajsh commented Jun 10, 2022

#1411 will fix this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants