NoSuchMethodError when using scalate

941 views
Skip to first unread message

FooBarFreak

unread,
Feb 24, 2013, 9:44:26 AM2/24/13
to sca...@googlegroups.com
Hi together,

I am new to scala and scalate. I am using the 1.6.1 version from maven central for scala 2.10. When I try to execute the following code:

val engine = new TemplateEngine
val output = engine.layout("/templates/map.mustache")

I get the following Error:

Caused by: java.lang.NoSuchMethodError: scala.reflect.internal.TreeInfo.firstArgument(Lscala/reflect/internal/Trees$Tree;)Lscala/reflect/internal/Trees$Tree;
at scala.tools.nsc.typechecker.Typers$Typer.parentTypes(Typers.scala:1550) ~[scala-compiler-2.10.0.jar:na]
at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:861) ~[scala-compiler-2.10.0.jar:na]
at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1300) ~[scala-compiler-2.10.0.jar:na]
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1347) ~[scala-compiler-2.10.0.jar:na]
[... Stacktrace shortened ...]
at scala.tools.nsc.Global$Run.compile(Global.scala:1654) ~[scala-compiler-2.10.0.jar:na]
at org.fusesource.scalate.support.ScalaCompiler.compile(ScalaCompiler.scala:100) ~[scalate-core_2.10-1.6.1.jar:1.6.1]
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:757) ~[scalate-core_2.10-1.6.1.jar:1.6.1]
... 54 common frames omitted

The Top level Exception is:

org.fusesource.scalate.TemplateException: scala.reflect.internal.TreeInfo.firstArgument(Lscala/reflect/internal/Trees$Tree;)Lscala/reflect/internal/Trees$Tree;

Does anybody have an Idea? My Template contains no mustache Elements:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=...&sensor=true"></script>
    <script type="text/javascript" src="/assets/js/jquery.min.js"></script>    
    <script type="text/javascript" src="/assets/js/foo.js"></script>     
    <script type="text/javascript" src="/assets/js/main.js"></script>     
  </head>
  <body onload="initialize();">
    <div id="map_canvas" style="width:100%; height:100%"></div>
  </body>
</html>
It seems like maybe my classpath is wrong. I am starting the project using an Eclipse run configuration. Here is a "screenshot" of my Eclipse classpath. I am using the latest  Scala IDE version as of today.


Any hints on how to approach this problem would be highly welcome.

Thanks a lot,
Sebastian

Rafał Krzewski

unread,
Feb 27, 2013, 10:44:08 AM2/27/13
to sca...@googlegroups.com
java.lang.NoSuchMethodError and it's ilk usually signal inconsistent classpath. 
At first glance it appears that you have scala-reflect.jar on your classpath that is not scala-reflect-2.10.0.jar 
It needs to be in perfect agreement with scala-library and scala-compiler jars. That's the first thing I'd check here.

cheers,
Rafał

FooBarFreak

unread,
Feb 27, 2013, 4:56:52 PM2/27/13
to sca...@googlegroups.com
Hi Rafal,

that seems to be the problem. The Eclipse IDE Plugin bundles Scala 2.10 M1 in which the firstArgument method is missing on TreeInfo. It is there in scala-reflect-2.10.jar. So it seems to be some classloading issue with the Eclipse IDE plus having the scala-*-2.10.0.jars on the classpath. What is strange is that the classpath ordering does not seem to be appropriate since the eclipse scala plugin library comes last in the classpath. Anyway: It has nothing to do with scalate. 

Interestingly enough If I bundle my application using onejar I get the error object scala.runtime in compiler mirror not found. I have to say that the whole scala reflection classpath system is quite confusing for a new user like me.

Thanks a lot for the help anyway. I now have a direction to direct my research towards.

Cheers,
Sebastian
Reply all
Reply to author
Forward
0 new messages