[
https://issues.apache.org/jira/browse/CASSANDRA-13396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Hubert updated CASSANDRA-13396:
------------------------------------
Status: Patch Available (was: Open)
Hi [~jasobrown]! Today, I took some time to prepare a patch against the
Cassandra 3.11 branch which basically:
* bundles all logback implementation specific functionality in one class
(required a bit of code reorganization)
* extracted an interface to be able to a) minimize use of reflection and b) be
able to provide alternative implementations (the patch itself only provides a
no-op fallback implementation)
* load and instantiate logging-implementation specific extension according to
used slf4j binding via reflection (Cassandra code only works on new interface
which has no java class dependencies to specific implementations)
So far there are no new (integration) tests which likely would also require
some classpath / ClassLoader magic.
I tested the change using "a neutral" application use case by utilizing
[Cassandra Unit|https://github.com/jsevellec/cassandra-unit].
The "test" involved adjusting log4j config from Cassandra Unit test resources,
changing the used cassandra-all version in parent pom, excluding logback deps
from the pom and executing any of the tests.
With stock Cassandra 3.11.2 we see:
{code:java}
2018-03-20 10:51:43,753 [pool-2-thread-1] ERROR
cassandra.service.CassandraDaemon - Exception encountered during startup
java.lang.NoClassDefFoundError: ch/qos/logback/classic/Logger
at
org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager.install(ThreadAwareSecurityManager.java:92)
at
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:192)
at
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:602)
at
org.cassandraunit.utils.EmbeddedCassandraServerHelper.lambda$startEmbeddedCassandra$1(EmbeddedCassandraServerHelper.java:144)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
{code}
Using the patch [^CASSANDRA-13396_ehubert_1.patch] I provided we have a
successful server startup with a warning:
{code:java}
2018-03-20 13:47:32,688 [pool-2-thread-1] WARN
utils.logging.LoggingSupportFactory - You are using Cassandra with an
unsupported deployment. The intended logging implementation library logback is
not used by slf4j. Detected slf4j binding: org.slf4j.impl.Log4jLoggerFactory.
You will not be able to dynamically manage log levels via JMX and may have
performance or other issues.
{code}
Please consider this as an initial patch suggestion to gather quick feedback on
the approach! I'm willing to adjust things according to your requirements or
are happy if you like to tweak it to your requirements.
Would be great to see this in Cassandra 3.11.3 if possible.
> Cassandra 3.10: ClassCastException in ThreadAwareSecurityManager
> ----------------------------------------------------------------
>
> Key: CASSANDRA-13396
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13396
> Project: Cassandra
> Issue Type: Bug
> Reporter: Edward Capriolo
> Assignee: Eugene Fedotov
> Priority: Minor
> Attachments: CASSANDRA-13396_ehubert_1.patch
>
>
> https://www.mail-archive.com/[email protected]/msg51603.html
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]