我正在使用 play-spring-data-jpa 模板并添加了Jinq。根据{{3}},我按照将Jinq初始化为Singleton Bean 的步骤进行操作。但是由于没有 application-context.xml 文件,我无处可添加
<bean id="jinq" class="com.example.JinqSource"/>
或Play等效。
我的堆栈跟踪:
java.lang.RuntimeException: Unknown constant: 18
scala.sys.package$.error(package.scala:27)
sbt.classfile.Parser$.getConstant(Parser.scala:150)
sbt.classfile.Parser$.parse$1(Parser.scala:127)
sbt.classfile.Parser$.sbt$classfile$Parser$$parseConstantPool(Parser.scala:132)
sbt.classfile.Parser$$anon$1.<init>(Parser.scala:32)
sbt.classfile.Parser$.parseImpl(Parser.scala:24)
sbt.classfile.Parser$.sbt$classfile$Parser$$parse(Parser.scala:20)
sbt.classfile.Parser$$anonfun$apply$1.apply(Parser.scala:19)
sbt.classfile.Parser$$anonfun$apply$1.apply(Parser.scala:19)
sbt.Using.apply(Using.scala:25)
sbt.classfile.Parser$.apply(Parser.scala:19)
sbt.classfile.Analyze$$anonfun$apply$2.apply(Analyze.scala:32)
sbt.classfile.Analyze$$anonfun$apply$2.apply(Analyze.scala:31)
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
scala.collection.AbstractTraversable.map(Traversable.scala:105)
sbt.classfile.Analyze$.apply(Analyze.scala:31)
sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:138)
sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:136)
scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
scala.collection.immutable.List.foreach(List.scala:318)
scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply$mcV$sp(AggressiveCompile.scala:136)
sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:136)
sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:136)
sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
sbt.compiler.AggressiveCompile$$anonfun$3.compileJava$1(AggressiveCompile.scala:135)
sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
sbt.inc.Incremental$.cycle(Incremental.scala:73)
sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
sbt.inc.Incremental$.compile(Incremental.scala:32)
sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
sbt.Compiler$.apply(Compiler.scala:70)
sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:722)
sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:716)
sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:716)
scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
sbt.std.Transform$$anon$4.work(System.scala:64)
sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
sbt.Execute.work(Execute.scala:244)
sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
我不熟悉Play框架,但似乎它可能让你使用JSR330 annotations for dependency injection而不是Spring使用的。所以我想也许你可以将JinqSource标记为@Singleton,而Play框架将能够为你正确连接,也许?
您获得的堆栈跟踪似乎是problem with using old versions of Scala's sbt with Java 8。您应该升级到较新版本的Scala工具。
如果您尝试将Jinq与Scala一起使用,则应使用Jinq for Scala JPA而不是普通的Jinq内容,因为它包含对Scala列表和lambda的支持。