What is the maximum number of case class fields in scala? - scala

It used to be 22, I heard someone say it's now 512? Is that correct? Can someone provide a source.

In Scala 2.11 there is an implicit limit, it seems if you create a case class with about more than 100 fields you get a stack overflow (see bottom of answer).
A workaround to get the number of fields higher (up to 254) is
export SBT_OPTS="-XX:MaxPermSize=2G -Xmx2G -Xms2G -Xss8M"
If you try any higher than 254 you get
[error] /Users/sams/src/.../src/main/scala/com/MegaClass.scala:6:12: Platform restriction: a parameter list's length cannot exceed 254.
[error] case class MegaClass(
Stack overflow error:
[error] null
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transformSelect$1(SuperAccessors.scala:253)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:335)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:359)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:71)
...
[error] scala.reflect.internal.Trees$class.itransform(Trees.scala:1345)
[error] scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
[error] scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
[error] scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
[error] scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.mayNeedProtectedAccessor$1(SuperAccessors.scala:186)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transformSelect$1(SuperAccessors.scala:332)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:335)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:359)
[error] scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:71)
[error] scala.reflect.internal.Trees$class.itransform(Trees.scala:1345)
[error]
[error] java.lang.StackOverflowError
[error] at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:178)
[error] at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:359)
[error] at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:71)
[error] at scala.reflect.internal.Trees$class.itransform(Trees.scala:1345)
[error] at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
[error] at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
[error] at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)

It's 22 if you want json (de)serialisation. At least in pre Scala 3. It might have changed in Scala 3.

Related

How to extract a standalone FPU module from Rocket-Chip Chisel code?

I am working on Rocket Chip Generator, which is a SoC written in Chisel.
My objective is to extract the Floating-Point Unit, in order to synthesize it and study its power consumption/area ...etc. separately from the rest of the SoC.
So I cloned the project and tried to create a dedicated TestHarness where I only instanciate an FPU. This is an example code of what I did (very similar to TestHarness
package freechips.rocketchip.system
import Chisel._
import freechips.rocketchip.config.Parameters
import freechips.rocketchip.devices.debug.Debug
import freechips.rocketchip.diplomacy.LazyModule
import freechips.rocketchip.rocket._
// importing FPU class
import freechips.rocketchip.tile._
class FPUTestHarness() (implicit p: Parameters) extends Module {
val io = new Bundle {
val dummyIn = Bool(INPUT)
val dummyOut = Bool(OUTPUT)
}
// The parameters of the FPU
val fpu_params = FPUParams(
fLen = 32 // default is 64
divSqrt = false // default is true
// sfmaLatency = 3, // default
// dfmaLatency = 4 // default
)
val fpu = Module(new FPU(fpu_params)(p))
}
The problem is that the implicit parameter p (of type Parameters) doesn't contain something called TileKey, which is needed I don't know where. Apparently the implicit parameter p, passed to FPUTestHarness doesn't contain that information. How can I resolve that? Is it possible to hardcode that somewhere for example?
rocket-chip-new/vsim$ make verilog
mkdir -p /home/mylab/rocket-chip/vsim/generated-src/
cd /home/mylab/rocket-chip && java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar /home/mylab/rocket-chip/sbt-launch.jar "runMain freechips.rocketchip.system.Generator /home/mylab/rocket-chip/vsim/generated-src freechips.rocketchip.system FPUTestHarness freechips.rocketchip.system DefaultConfig"
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
[info] Loading settings for project rocket-chip-new-build from plugins.sbt ...
[info] Loading project definition from /home/mylab/rocket-chip/project
[info] Loading settings for project rocketchip from build.sbt ...
[info] Loading settings for project hardfloat from build.sbt ...
[info] Loading settings for project chisel from build.sbt ...
Using addons:
[info] Set current project to rocketchip (in build file:/home/mylab/rocket-chip/)
[info] Compiling 1 Scala source to /home/mylab/rocket-chip/target/scala-2.12/classes ...
[warn] there were two feature warnings; re-run with -feature for details
[warn] one warning found
[info] Done compiling.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/aitsaidn/.sbt/boot/scala-2.12.7/org.scala-sbt/sbt/1.2.7/protobuf-java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
[info] Packaging /home/mylab/rocket-chip/target/scala-2.12/rocketchip_2.12-1.2-SNAPSHOT.jar ...
[info] Done packaging.
[info] Running freechips.rocketchip.system.Generator /home/mylab/rocket-chip/vsim/generated-src freechips.rocketchip.system FPUTestHarness freechips.rocketchip.system DefaultConfig
[info] [0.003] Elaborating design...
List(RocketTileParams(RocketCoreParams(0,true,false,true,true,false,true,false,0,1,false,8,0,true,false,true,0,Some(0),true,true,false,false,false,0,538447876,Some(MulDivParams(8,1,true,true,1)),Some(FPUParams(64,true,3,4))),Some(ICacheParams(64,4,64,32,0,None,None,None,false,64,2,4)),Some(DCacheParams(64,4,64,32,None,None,1,0,17,16,1,64,false,false,false,false,None)),Some(BTBParams(28,14,6,6,Some(BHTParams(512,1,8,3)),false)),0,Some(tile),0,None,None,false))
[error] (run-main-0) java.lang.reflect.InvocationTargetException
[error] java.lang.reflect.InvocationTargetException
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error] at freechips.rocketchip.util.HasGeneratorUtilities.$anonfun$elaborate$1(GeneratorUtils.scala:54)
[error] at chisel3.core.Module$.do_apply(Module.scala:52)
[error] at chisel3.Driver$.$anonfun$elaborate$1(Driver.scala:95)
[error] at chisel3.internal.Builder$.$anonfun$build$2(Builder.scala:343)
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at chisel3.internal.Builder$.$anonfun$build$1(Builder.scala:341)
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at chisel3.internal.Builder$.build(Builder.scala:341)
[error] at chisel3.Driver$.elaborate(Driver.scala:95)
[error] at freechips.rocketchip.util.HasGeneratorUtilities.elaborate(GeneratorUtils.scala:59)
[error] Caused by: java.lang.IllegalArgumentException: requirement failed: Key TileKey is not defined in Parameters
[error] at scala.Predef$.require(Predef.scala:277)
[error] at freechips.rocketchip.config.View.apply(Config.scala:15)
[error] at freechips.rocketchip.config.View.apply(Config.scala:12)
[error] at freechips.rocketchip.tile.HasNonDiplomaticTileParameters.tileParams(BaseTile.scala:37)
[error] at freechips.rocketchip.tile.HasNonDiplomaticTileParameters.tileParams$(BaseTile.scala:37)
[error] at freechips.rocketchip.tile.CoreModule.tileParams(Core.scala:90)
[error] at freechips.rocketchip.tile.HasCoreParameters.$init$(Core.scala:51)
[error] at freechips.rocketchip.tile.CoreModule.<init>(Core.scala:90)
[error] at freechips.rocketchip.tile.FPUModule.<init>(FPU.scala:378)
[error] at freechips.rocketchip.tile.FPU.<init>(FPU.scala:661)
[error] at freechips.rocketchip.system.FPUTestHarness.$anonfun$fpu$1(FPUTestHarness.scala:71)
[error] at chisel3.core.Module$.do_apply(Module.scala:52)
[error] at freechips.rocketchip.system.FPUTestHarness.<init>(FPUTestHarness.scala:71)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] Nonzero exit code: 1
[error] (Compile / runMain) Nonzero exit code: 1
[error] Total time: 6 s, completed Jul 25, 2019, 7:59:01 PM
/home/mylab/rocket-chip/vsim/Makefrag-verilog:12: recipe for target '/home/mylab/rocket-chip/vsim/generated-src/freechips.rocketchip.system.DefaultConfig.fir' failed
make: *** [/home/mylab/rocket-chip/vsim/generated-src/freechips.rocketchip.system.DefaultConfig.fir] Error 1
It seems that you use the config as "DefaultConfig". Error log states that you did not specify TileKey parameter in this config. Adding TileKey parameter will resolve the issue. DefaultConfig is defined in rocket-chip/src/main/scala/system/Configs.scala

How to add parameters to run SBT in Ammonite?

I want to run this SBT command in Ammonite:
sbt -mem 3000 clean compile docker:publishLocal
I tried a few things like:
%.sbt("-mem 3000", 'clean, 'test)(pwd)
Which gives this exception:
[error] Expected symbol
[error] Not a valid command: -
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected 'addPluginSbtFile'
[error] -mem 3000
[error] ^
How is this done?
I recently had to the same thing, and i can tell you that is not fun when those "random" errors happen.
// I had to put the full path where sbt is, like this
val SBT = "C:\\Program Files (x86)\\sbt\\bin\\sbt.bat"
%(SBT, "-mem", "3000", "clean", "compile", "docker:publishLocal")(pwd)
with this the solution is:
%.sbt("-mem", "3000", 'clean, 'test)(pwd)

Error:Expected letter.. while running play multi project

I was trying to run a play sbt multi-project using command 'sbt "project subproject" ~run'
But received following error:
`Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected ';'
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] Expected '-'
[error] “
[error] ^
`
I think what you want is sbt "~subproject/run"
I had this same problem and, it was because I was running sbt . (with a trailing period).
Just using sbt or sbt [command] solved the problem for me

How to debug scalajs linker error: non-existent method java.lang.Class.getDeclaredFields

After adding the following method to map case classes to Map or js.Dictionary - and I've tried now five or six variants of the following - my code compiles fine and without warnings, but then hits errors at the fastOptJS sjs linking stage.
The method
def ccToMap(cc: AnyRef) =
(Map[String, Any]() /: cc.getClass.getDeclaredFields) {
(a, f) =>
f.setAccessible(true)
a + (f.getName -> f.get(cc))
}
Note that all the variants I have tried do the same thing in a slightly different manner.
The error
[info] Fast optimizing /Users/justin/Desktop/arete/jt/client/target/scala-2.11/client-fastopt.js
[error] Referring to non-existent class java.lang.reflect.Field
[error] called from com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$.ccToMap(java.lang.Object)scala.collection.immutable.Map
[error] called from com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$.<init>()
[error] called from com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2.apply(japgolly.scalajs.react.extra.router.RouterCtl)japgolly.scalajs.react.ReactElement
[error] called from com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2.apply(java.lang.Object)java.lang.Object
[error] called from scala.collection.LinearSeqOptimized$class.foreach(scala.collection.LinearSeqOptimized,scala.Function1)scala.Unit
[error] called from scala.collection.mutable.MutableList.foreach(scala.Function1)scala.Unit
[error] called from scala.collection.TraversableLike$WithFilter.map(scala.Function1,scala.collection.generic.CanBuildFrom)java.lang.Object
[error] called from scala.collection.immutable.Stream$StreamWithFilter.map(scala.Function1,scala.collection.generic.CanBuildFrom)java.lang.Object
[error] called from org.scalajs.testinterface.internal.Slave.org$scalajs$testinterface$internal$Slave$$execute(scala.scalajs.js.Dynamic)scala.Unit
[error] called from org.scalajs.testinterface.internal.Slave.handleMsgImpl(java.lang.String,scala.Function0)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.handleMsg(java.lang.String)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.$$anonfun$1(java.lang.String)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.init()scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.$$js$exported$meth$init()java.lang.Object
[error] called from org.scalajs.testinterface.internal.BridgeBase.init
[error] exported to JavaScript with #JSExport
[error] involving instantiated classes:
[error] com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$
[error] com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2
[error] scala.collection.mutable.Queue
[error] scala.collection.mutable.MutableList
[error] scala.collection.TraversableLike$WithFilter
[error] scala.collection.immutable.Stream$StreamWithFilter
[error] org.scalajs.testinterface.internal.Slave
[error] org.scalajs.testinterface.internal.Master
[error] Referring to non-existent method java.lang.Class.getDeclaredFields() [java.lang.reflect.Field
[error] called from com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$.ccToMap(java.lang.Object)scala.collection.immutable.Map
[error] called from com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$.<init>()
[error] called from com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2.apply(japgolly.scalajs.react.extra.router.RouterCtl)japgolly.scalajs.react.ReactElement
[error] called from com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2.apply(java.lang.Object)java.lang.Object
[error] called from scala.collection.LinearSeqOptimized$class.foreach(scala.collection.LinearSeqOptimized,scala.Function1)scala.Unit
[error] called from scala.collection.mutable.MutableList.foreach(scala.Function1)scala.Unit
[error] called from scala.collection.TraversableLike$WithFilter.map(scala.Function1,scala.collection.generic.CanBuildFrom)java.lang.Object
[error] called from scala.collection.immutable.Stream$StreamWithFilter.map(scala.Function1,scala.collection.generic.CanBuildFrom)java.lang.Object
[error] called from org.scalajs.testinterface.internal.Slave.org$scalajs$testinterface$internal$Slave$$execute(scala.scalajs.js.Dynamic)scala.Unit
[error] called from org.scalajs.testinterface.internal.Slave.handleMsgImpl(java.lang.String,scala.Function0)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.handleMsg(java.lang.String)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.$$anonfun$1(java.lang.String)scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.init()scala.Unit
[error] called from org.scalajs.testinterface.internal.BridgeBase.$$js$exported$meth$init()java.lang.Object
[error] called from org.scalajs.testinterface.internal.BridgeBase.init
[error] exported to JavaScript with #JSExport
[error] involving instantiated classes:
[error] com.jshin47.jtdc.client.module.visualization.DiodeStateVizC$
[error] com.jshin47.jtdc.client.module.landing.LandingLocC$$anonfun$2
[error] scala.collection.mutable.Queue
[error] scala.collection.mutable.MutableList
[error] scala.collection.TraversableLike$WithFilter
[error] scala.collection.immutable.Stream$StreamWithFilter
[error] org.scalajs.testinterface.internal.Slave
[error] org.scalajs.testinterface.internal.Master
[trace] Stack trace suppressed: run last client/compile:fastOptJS for the full output.
[error] (client/compile:fastOptJS) There were linking errors
[error] Total time: 36 s, completed May 10, 2016 2:01:07 AM
What I've tried
Being unfamiliar with the details of the linker I am only able to try some "obvious" diagnostics:
Whether I call the method or not, this error is thrown (it doesn't have to be in the code path, so this is getting thrown when the method itself is linked)
The Map type itself works just fine as an argument to the function where I am trying to invoke this
I know to a certainty that iff this method (or similar) is present, then I get the above linker error. (Without, no error.)
Any tips on how to proceed, debug, etc are appreciated.
Alternatively, any tips on how I may convert a case class to a Map without the above-style (reflection-based) function, please let me know
You simply can't use Java reflection in Scala.js:
Java reflection and, a fortiori, Scala reflection, are not supported. There is limited support for java.lang.Class, e.g., obj.getClass.getName will work for any Scala.js object (not for objects that come from JavaScript interop).
Use macros for this instead. See e.g. Scala Macros: Making a Map out of fields of a class in Scala

Play framework, 2.x clean project, test fails - MAC OS

I think this should be due to some issues in my enviroment, I can't figure this out so I am posting a question.
I created a new play 2.1.3 project (scala 2.10.2).
When I run play for the first time (no file is edited at this stage) and run the test sbt command, I get the following error.
info] Updating {file:/private/tmp/myapp/}myapp...
[info] Done updating.
[info] Compiling 5 Scala sources and 1 Java source to /private/tmp/myapp/target/scala-2.10/classes...
[info] Compiling 2 Scala sources to /private/tmp/myapp/target/scala-2.10/test-classes...
log4j:WARN No appenders could be found for logger (play).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:224)
at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:299)
at java.util.logging.Logger.log(Logger.java:509)
at java.util.logging.Logger.doLog(Logger.java:531)
at java.util.logging.Logger.logp(Logger.java:647)
at org.jboss.netty.logging.JdkLogger.debug(JdkLogger.java:36)
at org.jboss.netty.logging.InternalLoggerFactory$1.debug(InternalLoggerFactory.java:80)
at org.jboss.netty.channel.socket.nio.SelectorUtil.<clinit>(SelectorUtil.java:57)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:115)
at play.core.server.NettyServer.play$core$server$NettyServer$$newBootstrap(NettyServer.scala:40)
at play.core.server.NettyServer.<init>(NettyServer.scala:127)
at play.api.test.TestServer.start(Selenium.scala:124)
at play.api.test.Helpers$.running(Helpers.scala:71)
at test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at org.specs2.mutable.SpecificationFeatures$$anon$1$$anonfun$asResult$1.apply(Specification.scala:34)
at org.specs2.mutable.SpecificationFeatures$$anon$1$$anonfun$asResult$1.apply(Specification.scala:34)
at org.specs2.execute.AsResult$$anon$10.asResult(Result.scala:230)
at org.specs2.execute.AsResult$.apply(Result.scala:238)
at org.specs2.specification.Contexts$$anon$4.apply(Contexts.scala:44)
at org.specs2.mutable.SpecificationFeatures$$anon$1.asResult(Specification.scala:34)
at org.specs2.execute.AsResult$.apply(Result.scala:238)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:141)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:141)
at org.specs2.specification.Example.execute(Fragment.scala:104)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:22)
at org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:76)
at org.specs2.specification.FragmentExecution$class.executeBody(FragmentExecution.scala:28)
at org.specs2.runner.TestInterfaceConsoleReporter.executeBody(TestInterfaceRunner.scala:125)
at org.specs2.specification.FragmentExecution$class.execute(FragmentExecution.scala:52)
at org.specs2.runner.TestInterfaceConsoleReporter.execute(TestInterfaceRunner.scala:125)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.control.Exceptions$class.catchAllOr(Exceptions.scala:54)
at org.specs2.control.Exceptions$.catchAllOr(Exceptions.scala:109)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$org$specs2$reporter$DefaultExecutionStrategy$$executeSequence$1.apply(ExecutionStrategy.scala:99)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$org$specs2$reporter$DefaultExecutionStrategy$$executeSequence$1.apply(ExecutionStrategy.scala:99)
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:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at org.specs2.reporter.DefaultExecutionStrategy$class.org$specs2$reporter$DefaultExecutionStrategy$$executeSequence(ExecutionStrategy.scala:99)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$execute$1$$anonfun$2.apply(ExecutionStrategy.scala:43)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$execute$1$$anonfun$2.apply(ExecutionStrategy.scala:41)
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.GenTraversableViewLike$Mapped$$anonfun$foreach$2.apply(GenTraversableViewLike.scala:81)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
at scala.collection.IterableViewLike$Transformed$class.foreach(IterableViewLike.scala:42)
at scala.collection.SeqViewLike$AbstractTransformed.foreach(SeqViewLike.scala:43)
at scala.collection.GenTraversableViewLike$Appended$class.foreach(GenTraversableViewLike.scala:99)
at scala.collection.SeqViewLike$$anon$2.foreach(SeqViewLike.scala:77)
at scala.collection.GenTraversableViewLike$Mapped$class.foreach(GenTraversableViewLike.scala:80)
at scala.collection.SeqViewLike$$anon$3.foreach(SeqViewLike.scala:78)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:144)
at scala.collection.SeqViewLike$AbstractTransformed.foldLeft(SeqViewLike.scala:43)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$execute$1.apply(ExecutionStrategy.scala:41)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$execute$1.apply(ExecutionStrategy.scala:38)
at org.specs2.internal.scalaz.syntax.IdOps$class.$bar$greater(IdOps.scala:15)
at org.specs2.internal.scalaz.syntax.ToIdOps$$anon$1.$bar$greater(IdOps.scala:68)
at org.specs2.reporter.AllExporting$class.report(AllExporting.scala:15)
at org.specs2.runner.TestInterfaceConsoleReporter.report(TestInterfaceRunner.scala:125)
at org.specs2.runner.TestInterfaceRunner.runSpecification(TestInterfaceRunner.scala:61)
at org.specs2.runner.TestInterfaceRunner.run(TestInterfaceRunner.scala:54)
at sbt.ForkMain$Run.runTests(ForkMain.java:157)
at sbt.ForkMain$Run.run(ForkMain.java:169)
at sbt.ForkMain.main(ForkMain.java:84)
[info] IntegrationSpec
[info]
[info] Application should
[error] ! work from within a browser
[error] RuntimeException: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V (Helpers.scala:71)
[error] play.api.test.TestServer.start(Selenium.scala:128)
[error] play.api.test.Helpers$.running(Helpers.scala:71)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
[error] org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:224)
[error] org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:299)
[error] org.jboss.netty.logging.JdkLogger.debug(JdkLogger.java:36)
[error] org.jboss.netty.logging.InternalLoggerFactory$1.debug(InternalLoggerFactory.java:80)
[error] org.jboss.netty.channel.socket.nio.SelectorUtil.<clinit>(SelectorUtil.java:57)
[error] org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:115)
[error] play.core.server.NettyServer.play$core$server$NettyServer$$newBootstrap(NettyServer.scala:40)
[error] play.core.server.NettyServer.<init>(NettyServer.scala:127)
[error] play.api.test.TestServer.start(Selenium.scala:124)
[error] play.api.test.Helpers$.running(Helpers.scala:71)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
[error] org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
[error] org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:224)
[error] org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:299)
[error] org.jboss.netty.logging.JdkLogger.debug(JdkLogger.java:36)
[error] org.jboss.netty.logging.InternalLoggerFactory$1.debug(InternalLoggerFactory.java:80)
[error] org.jboss.netty.channel.socket.nio.SelectorUtil.<clinit>(SelectorUtil.java:57)
[error] org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:115)
[error] play.core.server.NettyServer.play$core$server$NettyServer$$newBootstrap(NettyServer.scala:40)
[error] play.core.server.NettyServer.<init>(NettyServer.scala:127)
[error] play.api.test.TestServer.start(Selenium.scala:124)
[error] play.api.test.Helpers$.running(Helpers.scala:71)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
[error] test.IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
UPDATE - Problem Fixed
These files somehow managed to get into classpath,
rm /Library/Java/Extensions/log4j-1.2.15.jar
rm /Library/Java/Extensions/slf4j-api-1.5.8.jar
rm /Library/Java/Extentions/slf4j-log4j12-1.5.8.jar
I don't know which program placed these files.
Play logger will be called by default even if you don't use it. Check your application.conf
it contains something like:
# Root logger:
logger=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG
and Play.logger uses log4j and slf4j both as you can see above . So you need to configure them properly .
Check this question for setting up slf4 and log4j How to get SLF4J "Hello World" working with log4j?