简体   繁体   English

BootstrapMethodError - 找不到类定义

[英]BootstrapMethodError - cannot find class definition

I have a Java webapp running on Jetty (version 9.4.20).我有一个在 Jetty(版本 9.4.20)上运行的 Java webapp。 It uses a custom library for accessing MySql database, which has always worked well.它使用自定义库来访问 MySql 数据库,该库一直运行良好。

At random, sometimes, this exception is thrown:有时,随机抛出此异常:

java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/IndyBootstrapDispatcher
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:222)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:844)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
        at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1591)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:494)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: java/lang/IndyBootstrapDispatcher
        ... 36 more
java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/IndyBootstrapDispatcher
        at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1421)
        at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:286)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:510)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishResourceOnCheckin(C3P0PooledConnectionPool.java:406)
        at com.mchange.v2.resourcepool.BasicResourcePool.attemptRefurbishResourceOnCheckin(BasicResourcePool.java:1760)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$200(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask.run(BasicResourcePool.java:1378)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Caused by: java.lang.NoClassDefFoundError: java/lang/IndyBootstrapDispatcher

which freezes the service.这冻结了服务。

Strange thing is that everything was working and no changes to this library (dependencies, code, ...) or other updates were made.奇怪的是,一切正常,并且没有对该库(依赖项、代码等)进行任何更改或其他更新。

JDK used is 1.8.0_201.使用的 JDK 是 1.8.0_201。

Now, I know how to handle this kind of exception, but I have not found any reference to java lang IndyBootstrapDispatcher by crawling sources of the interested libraries.现在,我知道如何处理这种异常,但是我没有通过抓取感兴趣的库的源找到任何对java lang IndyBootstrapDispatcher的引用。

Any idea?任何的想法? Thank you all.谢谢你们。

Jetty is starting with system temp directory for the Java system property java.io.tmpdir . Jetty 从 Java 系统属性java.io.tmpdir系统临时目录开始。

This is typically the system /tmp directory.这通常是系统/tmp目录。

Jetty unpacks wars and accesses deep resources from your webapp from this temp directory. Jetty 从这个临时目录解压 wars 并从您的 web 应用程序访问深层资源。

What happens on some Linux distributions is that the the system temp directory ( /tmp ) is periodically cleaned up.在某些 Linux 发行版上发生的情况是系统临时目录 ( /tmp ) 会定期清理。 This can break a running Jetty instance as the content it needs has now been removed out from underneath it.这可能会破坏正在运行的 Jetty 实例,因为它需要的内容现在已经从它下面删除了。

The key is to use a temp directory for Jetty that isn't the system temp directory.关键是为 Jetty 使用一个不是系统临时目录的临时目录。

You can change the temp directory that Jetty uses in a number of ways.您可以通过多种方式更改 Jetty 使用的临时目录。

See: Jetty: How to change startup temp directory请参阅: Jetty:如何更改启动临时目录

Answering my own question if someone gets here.如果有人来这里回答我自己的问题。

This is due to ELK apm connector (version used 1.18.0 RC 1 in auto attach mode);这是由于ELK apm 连接器(在自动连接模式下使用 1.18.0 RC 1 的版本); by disabling the agent the errors go away.通过禁用代理,错误就会消失。 Further tests will be done on different agent versions.将在不同的代理版本上进行进一步的测试。

Relevant GitHub issues here and here .此处此处的相关 GitHub 问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM