java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32477145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 12:37:53  来源:igfitidea点击:

java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy?

java

提问by user3198603

while starting my weblogic(having my app war file containing logback-classic-1.0.1.jar),i am getting below exception.Any suggestion ?

在启动我的 weblogic 时(我的应用程序 war 文件包含 logback-classic-1.0.1.jar),我遇到了异常。有什么建议吗?

<Sep 9, 2015 9:27:13 AM UTC> <Warning> <Common> <BEA-000632> <Resource Pool "JDBC Data Source-0" shutting down, ignoring 3 resources still in use by applications..>
Exception in thread "Thread-12" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
        at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
        at ch.qos.logback.classic.Logger.log(Logger.java:824)
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:58)
        at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
        at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
        ................
        at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
        ... 18 more
Exception in thread "Thread-18" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
        at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
        at ch.qos.logback.classic.Logger.log(Logger.java:824)
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:58)
        at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
        at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
        .......................
        at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
    ... 18 more

采纳答案by user3198603

This type of exception occurs when your classpath does not contain this class.
If the jar's class is in your classpath, you pay attention to what classpath application you using at runtime. Indeed, often, classpath can be overwritten during runtime, or simply you can use a different one (for example, in a startup script).

当您的类路径不包含此类时,会发生此类异常。
如果 jar 的类在您的类路径中,请注意您在运行时使用的类路径应用程序。实际上,类路径通常可以在运行时被覆盖,或者您可以使用不同的路径(例如,在启动脚本中)。

回答by Marged

The class that is missing definitely exists in the JAR you have, I checked logback-classic-1.0.1.jar:

缺少的类肯定存在于您拥有的 JAR 中,我检查了 logback-classic-1.0.1.jar:

2012-03-07 07:34:18 .....         4729         2018  ch\qos\logback\classic\spi\ThrowableProxy.class

Make sure your classpath is set up correctly. By the way: if possible update logback because this version is 3 years old.

确保您的类路径设置正确。顺便说一句:如果可能的话更新 logback,因为这个版本已经 3 岁了。

回答by Anton Tománek

Two options I see(not enough information yet): 1. It happens right upon loading, I bet for classpath, see answers above. 2. It happens after some time, when app is runnig(my case), read next paragraphs.

我看到的两个选项(还没有足够的信息): 1. 它在加载时发生,我打赌类路径,请参阅上面的答案。2.它发生在一段时间后,当应用程序运行时(我的情况),阅读下一段。

When I got class not found errors and also have the same error like you right now, quite offten is issued with no space left on device aka full disk, full memory.

当我遇到 class not found 错误并且现在也有与您一样的错误时,通常会在设备上没有剩余空间(即完整磁盘,完整内存)。

My environment, is spring boot, logback is included automagicaly, in maven have repackage, so wverithing I need is included. This error occures after my app is runnig for 20 minutes or so, is has thousands of threads. If you do not limit memory for your virtual maschine, it can get very high even if it is not necessary.

我的环境是 spring boot,自动包含 logback,在 maven 中重新打包,所以包含了我需要的所有内容。在我的应用程序运行 20 分钟左右后发生此错误,它有数千个线程。如果您不限制虚拟机的内存,即使没有必要,它也会变得非常高。

Once(2 days ago) I spend 3 hours looking around claspath stuf, ... issue was full disk

曾经(2 天前)我花了 3 个小时查看 claspath stuf,...问题是磁盘已满

回答by Render

I have been getting this same error when breaking out (ctrl-c) from Dropwizard server, I finally learned why I get it.

从 Dropwizard 服务器退出 (ctrl-c) 时,我也遇到了同样的错误,我终于知道为什么我会得到它。

My Dropwizard is build into one fat jar, that I build with Gradle, and when running server on my local computer I run it directly from build/libs/...fat.jar

我的 Dropwizard 被构建到一个胖 jar 中,我用 Gradle 构建,当我在本地计算机上运行服务器时,我直接从 build/libs/...fat.jar 运行它

So this exception occurs when I have changed source code, built app-server again, and Gradle has overwritten the same jar I am currently running with "java -jar ...", so it's not that weird that classes that haven't been used before that session will not load ok :)

因此,当我更改源代码,再次构建应用程序服务器,并且 Gradle 覆盖了我当前正在使用“java -jar ...”运行的同一个 jar 时,会发生此异常,因此没有使用的类并不奇怪在该会话之前使用将无法加载 :)

回答by Cheng

If you exactly ensure that logback-class and logback-core already are in your classpath. See below. In your Logback.xml, you need add debug="true"

如果您确实确保 logback-class 和 logback-core 已经在您的类路径中。见下文。在您的 Logback.xml 中,您需要添加debug="true"

<configuration debug="true">

I encountered the problem 'java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy' in my tomcat. However, after adding debug = 'true', anything is ok.

我在我的 tomcat 中遇到了问题 'java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy'。但是,添加 debug = 'true' 后,一切正常。

回答by rogerdpack

For us, appears this meant "you are running out of file handles, increase your open file handle limit." (too many sockets were being created, using them all up). Credit to the original answer here.

对我们来说,这似乎意味着“您的文件句柄用完了,请增加打开的文件句柄限制”。(创建的套接字太多,全部用完)。归功于此处的原始答案。

Other things I've seen: make sure your spring boot is at least 1.3.8

我见过的其他东西:确保你的弹簧靴至少是 1.3.8

Also make sure the jars underneath aren't being overwritten/changed/unstable file system. FWIW.

还要确保下面的 jars 没有被覆盖/更改/不稳定的文件系统。FWIW。

回答by ton

This error happens when spring applications jar are rebuilt, removed, or updated during execution.

在执行期间重建、删除或更新 spring 应用程序 jar 时会发生此错误。

Ref: https://github.com/spring-projects/spring-boot/issues/4968

参考:https: //github.com/spring-projects/spring-boot/issues/4968

回答by Aliuk

I solved this problem by doing "mvn install" instead of "mvn clean install".

我通过执行“mvn install”而不是“mvn clean install”解决了这个问题。