构建Play 2.6 Java项目时出现Scala java.lang.StackOverflowError

时间:2018-09-11 13:29:04

标签: java scala amazon-s3 playframework sbt

我已经将项目迁移到Play 2.6.18。 Scala版本是2.12.6。当我运行“ sbt编译”或“ sbt更新”或“ sbt运行”时,出现以下异常:

    [info] Installing the s3:// URLStreamHandler via java.net.URL.setURLStreamHandlerFactory
    [info] Creating a new Ivy URLHandlerDispatcher to handle s3:// URLs
    java.lang.StackOverflowError
        at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4216)
        at scala.reflect.internal.Types$SubstMap.apply(Types.scala:4672)
        at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4221)
        at scala.reflect.internal.Types$SubstMap.apply(Types.scala:4672)
        at scala.reflect.internal.Types$SubstMap.apply(Types.scala:4643)
        at scala.collection.immutable.List.loop$1(List.scala:170)
        at scala.collection.immutable.List.mapConserve(List.scala:186)
        at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4184)
        at scala.reflect.internal.Types$SubstMap.apply(Types.scala:4672)
        at scala.reflect.internal.Types$Type.subst(Types.scala:796)
        at scala.reflect.internal.Types$Type.instantiateTypeParams(Types.scala:572)
        at scala.reflect.internal.Types$ExistentialType.withTypeVars(Types.scala:2848)
        at scala.reflect.internal.Types$class.thirdTry$1(Types.scala:6150)
        at scala.reflect.internal.Types$class.secondTry$1(Types.scala:6109)
        at scala.reflect.internal.Types$class.firstTry$1(Types.scala:6085)
        at scala.reflect.internal.Types$class.isSubType2(Types.scala:6228)
        at scala.reflect.internal.Types$class.isSubType(Types.scala:5837)
        at scala.reflect.internal.SymbolTable.isSubType(SymbolTable.scala:13)
        at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:872)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.loop$1(Implicits.scala:595)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.checkCompatibility(Implicits.scala:597)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.normSubType(Implicits.scala:374)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.matchesPt(Implicits.scala:513)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$matchesPt(Implicits.scala:525)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.survives(Implicits.scala:855)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation$$anonfun$15$$anonfun$16.apply(Implicits.scala:909)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation$$anonfun$15$$anonfun$16.apply(Implicits.scala:909)
        at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263)
        at scala.collection.AbstractTraversable.filter(Traversable.scala:105)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation$$anonfun$15.apply(Implicits.scala:909)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation$$anonfun$15.apply(Implicits.scala:908)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.<init>(Implicits.scala:908)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1040)
        at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1409)
        at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:82)
        at scala.tools.nsc.Global$$anon$1.inferImplicit(Global.scala:493)
        at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:40)
        at scala.tools.nsc.Global$$anon$1.inferImplicit(Global.scala:493)
        at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$wrapImplicit$1(Typers.scala:202)
        at scala.tools.nsc.typechecker.Typers$Typer.inferView(Typers.scala:209)
        at scala.tools.nsc.typechecker.Typers$Typer.inferView(Typers.scala:180)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1201)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1283)
        at scala.tools.nsc.typechecker.Typers$Typer.fallBack$1(Typers.scala:1274)
....

我试图通过使用-Xss2M在项目根目录中创建.jvmopts和.sbtopts文件来增加堆栈大小,并且还向build.sbt添加了javaOptions in compile += "-Xss2048K",但没有任何帮助。还有什么可以做的?

1 个答案:

答案 0 :(得分:0)

有时没有足够的内存来编译项目,这个命令会解决它:

export SBT_OPTS="-XX:+CMSClassUnloadingEnabled -Xmx8G"