ScalaSigParserError: Unexpected error: Not a valid class file

xz43發表於2016-10-26
Web專案使用Tomcat8.5.6(jdk1.8.0_31)的Debug模式啟動控制檯報錯
scala.tools.scalap.scalax.rules.ScalaSigParserError: Unexpected error: Not a valid class file
    at scala.tools.scalap.scalax.rules.Rules$$anonfun$expect$1.apply(Rules.scala:76)
    at scala.tools.scalap.scalax.rules.scalasig.ClassFileParser$.parse(ClassFileParser.scala:97)
...
26-Oct-2016 17:15:26.691 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
26-Oct-2016 17:15:26.691 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
26-Oct-2016 17:15:27.348 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@5b1420d9]) and a value of type [scala.concurrent.forkjoin.ForkJoinPool.Submitter] (value [scala.concurrent.forkjoin.ForkJoinPool$Submitter@19cfa681]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

下面是localhost日誌的具體內容:
26-Oct-2016 17:15:26.691 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.scalatra.servlet.ScalatraListener
 java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:165)
at scala.tools.scalap.scalax.rules.scalasig.ByteCode.<init>(ClassFileParser.scala:40)
at scala.tools.scalap.scalax.rules.scalasig.ByteCode.take(ClassFileParser.scala:45)
at scala.tools.scalap.scalax.rules.scalasig.ByteCode.next(ClassFileParser.scala:43)
at scala.tools.scalap.scalax.rules.scalasig.ByteCodeReader$$anonfun$bytes$1.apply(ClassFileParser.scala:95)
at scala.tools.scalap.scalax.rules.scalasig.ByteCodeReader$$anonfun$bytes$1.apply(ClassFileParser.scala:95)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.SeqRule.scala$tools$scalap$scalax$rules$SeqRule$$rep$2(SeqRule.scala:89)
at scala.tools.scalap.scalax.rules.SeqRule$$anonfun$times$1.apply(SeqRule.scala:98)
at scala.tools.scalap.scalax.rules.SeqRule$$anonfun$times$1.apply(SeqRule.scala:98)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.SeqRule.scala$tools$scalap$scalax$rules$SeqRule$$rep$2(SeqRule.scala:89)
at scala.tools.scalap.scalax.rules.SeqRule$$anonfun$times$1.apply(SeqRule.scala:98)
at scala.tools.scalap.scalax.rules.SeqRule$$anonfun$times$1.apply(SeqRule.scala:98)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:35)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$flatMap$1.apply(Rule.scala:34)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rule$$anonfun$mapResult$1.apply(Rule.scala:45)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:62)
at scala.tools.scalap.scalax.rules.Rules$DefaultRule.apply(Rules.scala:60)
at scala.tools.scalap.scalax.rules.Rules$$anonfun$expect$1.apply(Rules.scala:66)
at scala.tools.scalap.scalax.rules.scalasig.ClassFileParser$.parse(ClassFileParser.scala:99)
at org.scalatra.swagger.reflect.ScalaSigReader$.parseClassFileFromByteCode(ScalaSigReader.scala:138)
at org.scalatra.swagger.reflect.ScalaSigReader$.findScalaSig(ScalaSigReader.scala:133)
at org.scalatra.swagger.reflect.ScalaSigReader$.findClass(ScalaSigReader.scala:41)
at org.scalatra.swagger.reflect.ScalaSigReader$.readConstructor(ScalaSigReader.scala:25)
at org.scalatra.swagger.reflect.Reflector$.org$scalatra$swagger$reflect$Reflector$$ctorParamType$1(Reflector.scala:133)
at org.scalatra.swagger.reflect.Reflector$$anonfun$5.apply(Reflector.scala:123)
at org.scalatra.swagger.reflect.Reflector$$anonfun$5.apply(Reflector.scala:120)
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.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at org.scalatra.swagger.reflect.Reflector$.org$scalatra$swagger$reflect$Reflector$$ctorParamType$1(Reflector.scala:120)
at org.scalatra.swagger.reflect.Reflector$$anonfun$constructors$1$1$$anonfun$10.apply(Reflector.scala:153)
at org.scalatra.swagger.reflect.Reflector$$anonfun$constructors$1$1$$anonfun$10.apply(Reflector.scala:146)
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.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at org.scalatra.swagger.reflect.Reflector$$anonfun$constructors$1$1.apply(Reflector.scala:146)
at org.scalatra.swagger.reflect.Reflector$$anonfun$constructors$1$1.apply(Reflector.scala:140)
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.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at org.scalatra.swagger.reflect.Reflector$.constructors$1(Reflector.scala:139)
at org.scalatra.swagger.reflect.Reflector$.createDescriptor(Reflector.scala:160)
at org.scalatra.swagger.reflect.Reflector$$anonfun$describe$2.apply(Reflector.scala:44)
at org.scalatra.swagger.reflect.Reflector$$anonfun$describe$2.apply(Reflector.scala:44)
at org.scalatra.swagger.reflect.package$Memo.apply(package.scala:16)
at org.scalatra.swagger.reflect.Reflector$.describe(Reflector.scala:44)
at org.scalatra.swagger.Swagger$.collectModels(Swagger.scala:59)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:72)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:71)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:105)
at org.scalatra.swagger.Swagger$.collectModels(Swagger.scala:71)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:72)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:71)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:105)
at org.scalatra.swagger.Swagger$.collectModels(Swagger.scala:71)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:72)
at org.scalatra.swagger.Swagger$$anonfun$11.apply(Swagger.scala:71)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:144)
at scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:105)
at org.scalatra.swagger.Swagger$.collectModels(Swagger.scala:71)
at org.scalatra.swagger.Swagger$.collectModels(Swagger.scala:48)
at org.scalatra.swagger.SwaggerSupportSyntax$class.registerModel(SwaggerSupport.scala:381)
。。。
at ScalatraBootstrap.init(ScalatraBootstrap.scala:24)
at org.scalatra.servlet.ScalatraListener.configureCycleClass(ScalatraListener.scala:67)
at org.scalatra.servlet.ScalatraListener.contextInitialized(ScalatraListener.scala:23)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$240(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/664371420.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)


折騰好久,發現不用debug模式啟動可以正常啟動。
[2016-10-26 04:57:45,548] Artifact abc:war: Artifact is deployed successfully
[2016-10-26 04:57:45,548] Artifact abc:war: Deploy took 32,297 milliseconds

後來網上找到一篇文章,說這是jdk1.8的bug(),可以透過新增VM的引數  -XX:-EliminateAutoBox 來使當前的JDK支援tomcat的Debug模式。
先設定該引數,搞得。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9399028/viewspace-2127165/,如需轉載,請註明出處,否則將追究法律責任。

相關文章