Tomcat 7随ClassNotFoundException

时间:2018-12-27 16:10:12

标签: scala tomcat tomcat7 classnotfoundexception noclassdeffounderror

我有一个运行在Tomcat7中的Scala应用程序,该服务器最近由于ClassNotFoundException等标准类的scala.collection.immutable.ListSet错误而开始随机崩溃,即使服务器已经运行了一段时间了。错误开始变得越来越频繁,现在我们每天在某些服务器上发生几次崩溃

这是我们在catalina.out日志文件中获取的崩溃日志的示例。

Dec 25, 2018 8:50:47 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 25, 2018 8:50:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6938 ms
Uncaught error from thread [TPDispatcher-akka.actor.default-dispatcher-4] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[TPDispatcher]
java.lang.NoClassDefFoundError: scala/collection/immutable/ListSet$
        at scala.collection.immutable.HashSet$HashSet1.updated0(HashSet.scala:145)
        at scala.collection.immutable.HashSet$HashTrieSet.updated0(HashSet.scala:227)
        at scala.collection.immutable.HashSet$HashTrieSet.updated0(HashSet.scala:227)
        at scala.collection.immutable.HashSet$HashTrieSet.updated0(HashSet.scala:227)
        at scala.collection.immutable.HashSet$HashTrieSet.updated0(HashSet.scala:227)
        at scala.collection.immutable.HashSet.$plus(HashSet.scala:56)
        at scala.collection.immutable.HashSet.$plus(HashSet.scala:33)
        at scala.collection.mutable.SetBuilder.$plus$eq(SetBuilder.scala:24)
        at scala.collection.mutable.SetBuilder.$plus$eq(SetBuilder.scala:22)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
        at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
        at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
        at scala.collection.SetLike$class.map(SetLike.scala:93)
        at scala.collection.AbstractSet.map(Set.scala:47)
        at com.mycompany.lib.actors.BadgeUpdater.updateBadge(BadgeUpdater.scala:23)
        at com.mycompany.lib.actors.BadgeUpdater$$anonfun$receive$1.applyOrElse(BadgeUpdater.scala:15)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
        at com.twinpush.tp_dispatcher.lib.actors.BadgeUpdater.aroundReceive(BadgeUpdater.scala:11)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
        at akka.actor.ActorCell.invoke(ActorCell.scala:487)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
        at akka.dispatch.Mailbox.run(Mailbox.scala:220)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: scala.collection.immutable.ListSet$
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1859)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1702)
        ... 33 more
Dec 26, 2018 2:15:31 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Dec 26, 2018 2:15:31 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina

我尝试了几次重新编译,但是没有运气。我不知道是什么原因可能导致ClassNotFoundException在已经运行的服务器上,所以任何提示将不胜感激。


环境信息:

Scala version:  2.10.4
Server version: Apache Tomcat/7.0.68 (Ubuntu)
Server built:   Oct 30 2018 12:54:52 UTC
Server number:  7.0.68.0
OS Name:        Linux
OS Version:     4.4.0-141-generic
Architecture:   amd64
JVM Version:    1.8.0_191-8u191-b12-0ubuntu0.16.04.1-b12
JVM Vendor:     Oracle Corporation

1 个答案:

答案 0 :(得分:0)

结果证明我有一个库正在泄漏​​文件描述符,并且在某个时候JVM无法打开class文件(甚至可能吗?)。升级该库可修复泄漏,并且JVM不再崩溃。