我有一个自定义的LogBack appender。使用appender和自定义appender的类被编译到一个jar文件中。该应用程序在DSE spark集群上运行。我在每个节点上进行了logback.xml更改。当我运行应用程序时,我看到错误
17:39:35,039 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [com.test.logger.CassandraAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type com.test.logger.CassandraAppender
Caused by: java.lang.ClassNotFoundException: com.test.logger.CassandraAppender
at at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionH
elper.java:60)
将jar文件复制到/ home / [myuser]目录并从那里执行。缺什么? Logback在哪里查找自定义appender?
答案 0 :(得分:0)
似乎Logback加载Appender的方式与Spark不兼容(我遇到了logstash-logback-encoder这个问题)。我成功地将包含Appender类的Jar放入${SPARK_HOME}/jars
目录。