How do I see where this compilation error is occurring?
I'm trying to compile a scala project. It has a pom file declaring the dependencies. When I do a Build All, I get this error:
scala: Error: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/HttpServlet
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getEnclosingMethod0(Native Method)
at java.lang.Class.getEnclosingMethodInfo(Class.java:949)
at java.lang.Class.getEnclosingClass(Class.java:1101)
at sbt.ClassToAPI$.isTopLevel(ClassToAPI.scala:44)
at sbt.ClassToAPI$$anonfun$3.apply(ClassToAPI.scala:20)
at sbt.ClassToAPI$$anonfun$3.apply(ClassToAPI.scala:20)
at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263)
at scala.collection.AbstractTraversable.filter(Traversable.scala:105)
at sbt.ClassToAPI$.process(ClassToAPI.scala:20)
at sbt.compiler.AggressiveCompile$$anonfun$6.sbt$compiler$AggressiveCompile$$anonfun$$readAPI$1(AggressiveCompile.scala:139)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$8.apply(AggressiveCompile.scala:147)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$8.apply(AggressiveCompile.scala:147)
at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:45)
at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:43)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:98)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at sbt.classfile.Analyze$.apply(Analyze.scala:43)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:147)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:145)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2.apply$mcV$sp(AggressiveCompile.scala:145)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:145)
at sbt.compiler.AggressiveCompile$$anonfun$6$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:145)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:173)
at sbt.compiler.AggressiveCompile$$anonfun$6.compileJava$1(AggressiveCompile.scala:144)
at sbt.compiler.AggressiveCompile$$anonfun$6.apply(AggressiveCompile.scala:151)
at sbt.compiler.AggressiveCompile$$anonfun$6.apply(AggressiveCompile.scala:89)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37)
at sbt.inc.Incremental$.cycle(Incremental.scala:75)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:34)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:42)
at sbt.inc.Incremental$.compile(Incremental.scala:33)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:27)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:164)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:73)
at org.jetbrains.jps.incremental.scala.local.CompilerImpl.compile(CompilerImpl.scala:61)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:31)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.martiansoftware.nailgun.NGSession.run(Unknown Source)
However I have no idea where the problem is because it doesn't tell me what class failed to compile.
Please sign in to leave a comment.
The message is from SBT compiler, we can't clarify it more. I would suggest you to get next nighlty build of Scala plugin when it will be available tonight (http://confluence.jetbrains.com/display/SCA/Scala+Plugin+Nightly+Builds+for+Cardea). It will contain non-SBT compiler. So probably message will be different or disappear (then it's SBT compiler bug, however new compiler will be faster, that's another reason to migrate).
Best regards,
Alexander Podkhalyuzin.
How do I change the compiler? I tried turning off the external compiler but that didn't change anything. I'm using latest greatest 13 EAP.
I'll upload soon Scala plugin version (into plugin repository, not nightly) with re-implemented incremental compilation enabled by default.
For now in nightly builds you can open IDE Settings -> Scala -> Incremental compilation by: -> IntelliJ IDEA.
Best regards,
Alexander Podkhalyuzin.