我有一个 java 类,它在启动时创建一个基于 javassist 类加载器的自定义类加载器,然后运行真正的程序类。我收到以下错误:
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a
"org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [javassist.Loader@6f97b10a] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
[java.net.URLClassLoader@5b414a8d].
log4j:ERROR Could not instantiate appender named "stdout".
问题与一个对象是由原始类加载器创建的,而另一个是由自定义类加载器创建的这一事实有关。
有没有办法解决这个错误?
提前致谢,
阿夫纳