在我的play-scala应用程序中,在webpack.config.js函数中运行命令
输出:{path:__dirname +' / public / compiled',filename:' bundle.js' }
正在生成文件bundle.js.我的观点有下一个命令:
<script src=@routes.Assets.versioned("compiled/bundle.js")></script>
我得到一个错误,说&#34;无法加载资源:服务器响应状态为500&#34;。我看到它正在寻找assets / compiled / bundle.js。我需要在play-scala配置中做些什么改变才能使bundle.js文件可以找到!
我的路线也有:
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
由于
错误 内部服务器错误,对于(GET)[/assets/compiled/bundle.js] - &gt;
play.api.http.HttpErrorHandlerExceptions $$ anon $ 1:执行异常[[RuntimeException:java.lang.NoSuchMethodError:org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava / lang / String;)Ljava /朗/字符串;]] at play.api.http.HttpErrorHandlerExceptions $ .throwableToUsefulException(HttpErrorHandler.scala:265)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.GlobalSettings $ class.onError(GlobalSettings.scala:179)[play_2.11-2.4.3.jar:2.4.3] at play.api.DefaultGlobal $ .onError(GlobalSettings.scala:212)[play_2.11-2.4.3.jar:2.4.3] at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:94)[play_2.11-2.4.3.jar:2.4.3] at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 9 $$ anonfun $ apply $ 1.applyOrElse(PlayDefaultUpstreamHandler.scala:158)[play-netty-server_2.11-2.4.3.jar:2.4.3] at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 9 $$ anonfun $ apply $ 1.applyOrElse(PlayDefaultUpstreamHandler.scala:155)[play-netty-server_2.11-2.4.3.jar:2.4.3] 在scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)[scala-library-2.11.8.jar:na] 在scala.util.Failure $$ anonfun $ recover $ 1.apply(Try.scala:216)[scala-library-2.11.8.jar:na] 在scala.util.Try $ .apply(Try.scala:192)[scala-library-2.11.8.jar:na] 在scala.util.Failure.recover(Try.scala:216)[scala-library-2.11.8.jar:na] 在scala.concurrent.Future $$ anonfun $ recover $ 1.apply(Future.scala:326)[scala-library-2.11.8.jar:na] 在scala.concurrent.Future $$ anonfun $ recover $ 1.apply(Future.scala:326)[scala-library-2.11.8.jar:na] 在scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)[scala-library-2.11.8.jar:na] at play.api.libs.iteratee.Execution $ trampoline $ .executeScheduled(Execution.scala:109)[play-iteratees_2.11-2.4.3.jar:2.4.3] at play.api.libs.iteratee.Execution $ trampoline $ .execute(Execution.scala:71)[play-iteratees_2.11-2.4.3.jar:2.4.3] 在scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40)[scala-library-2.11.8.jar:na] at scala.concurrent.impl.Promise $ DefaultPromise.tryComplete(Promise.scala:248)[scala-library-2.11.8.jar:na] 在scala.concurrent.Promise $ class.complete(Promise.scala:55)[scala-library-2.11.8.jar:na] 在scala.concurrent.impl.Promise $ DefaultPromise.complete(Promise.scala:153)[scala-library-2.11.8.jar:na] 在scala.concurrent.impl.Future $ PromiseCompletingRunnable.run(Future.scala:23)[scala-library-2.11.8.jar:na] at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)[akka-actor_2.11.jar:na] at akka.dispatch.ForkJoinExecutorConfigurator $ AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)[akka-actor_2.11.jar:na] 在scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)[scala-library-2.11.8.jar:na] 在scala.concurrent.forkjoin.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1339)[scala-library-2.11.8.jar:na] 在scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)[scala-library-2.11.8.jar:na] 在scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)[scala-library-2.11.8.jar:na] 引起:java.lang.RuntimeException:java.lang.NoSuchMethodError:org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava / lang / String;)Ljava / lang / String; at play.api.mvc.ActionBuilder $$ anon $ 1.apply(Action.scala:498)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $$ anonfun $ apply $ 1 $$ anonfun $ apply $ 4 $$ anonfun $ apply $ 5.apply(Action.scala:105)〜[play_2.11-2.4.3.jar:2.4.3 ] at play.api.mvc.Action $$ anonfun $ apply $ 1 $$ anonfun $ apply $ 4 $$ anonfun $ apply $ 5.apply(Action.scala:105)〜[play_2.11-2.4.3.jar:2.4.3 ] at play.utils.Threads $ .withContextClassLoader(Threads.scala:21)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $$ anonfun $ apply $ 1 $$ anonfun $ apply $ 4.apply(Action.scala:104)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $$ anonfun $ apply $ 1 $$ anonfun $ apply $ 4.apply(Action.scala:103)〜[play_2.11-2.4.3.jar:2.4.3] 在scala.Option.map(Option.scala:146)〜[scala-library-2.11.8.jar:na] at play.api.mvc.Action $$ anonfun $ apply $ 1.apply(Action.scala:103)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $$ anonfun $ apply $ 1.apply(Action.scala:96)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.libs.iteratee.DoneIteratee $$ anonfun $ mapM $ 2.apply(Iteratee.scala:741)〜[play-iteratees_2.11-2.4.3.jar:2.4.3] at play.api.libs.iteratee.DoneIteratee $$ anonfun $ mapM $ 2.apply(Iteratee.scala:741)〜[play-iteratees_2.11-2.4.3.jar:2.4.3] at scala.concurrent.impl.Future $ PromiseCompletingRunnable.liftedTree1 $ 1(Future.scala:24)[scala-library-2.11.8.jar:na] 在scala.concurrent.impl.Future $ PromiseCompletingRunnable.run(Future.scala:24)[scala-library-2.11.8.jar:na] ...省略了6个常见帧 引起:java.lang.NoSuchMethodError:org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava / lang / String;)Ljava / lang / String; at play.api.libs.Codecs $ .sha1(Codecs.scala:35)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetInfo $$ anonfun $ 5 $$ anonfun $ apply $ 3.apply(Assets.scala:187)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetInfo $$ anonfun $ 5 $$ anonfun $ apply $ 3.apply(Assets.scala:187)〜[play_2.11-2.4.3.jar:2.4.3] 在scala.Option.map(Option.scala:146)〜[scala-library-2.11.8.jar:na] 在controllers.AssetInfo $$ anonfun $ 5.apply(Assets.scala:187)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetInfo $$ anonfun $ 5.apply(Assets.scala:187)〜[play_2.11-2.4.3.jar:2.4.3] 在scala.Option.orElse(Option.scala:289)〜[scala-library-2.11.8.jar:na] 在controllers.AssetInfo。(Assets.scala:187)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.Assets $$ anonfun $ controllers $ Assets $$ assetInfoFromResource $ 1 $$ anonfun $ apply $ 4.apply(Assets.scala:287)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.Assets $$ anonfun $ controllers $ Assets $$ assetInfoFromResource $ 1 $$ anonfun $ apply $ 4.apply(Assets.scala:284)〜[play_2.11-2.4.3.jar:2.4.3] 在scala.Option.map(Option.scala:146)〜[scala-library-2.11.8.jar:na] 在controllers.Assets $$ anonfun $ controllers $ Assets $$ assetInfoFromResource $ 1.apply(Assets.scala:284)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.Assets $$ anonfun $ controllers $ Assets $$ assetInfoFromResource $ 1.apply(Assets.scala:284)〜[play_2.11-2.4.3.jar:2.4.3] at akka.dispatch.MonitorableThreadFactory $ AkkaForkJoinWorkerThread $$ anon $ 3.block(ThreadPoolBuilder.scala:169)〜[akka-actor_2.11.jar:na] 在scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640)[scala-library-2.11.8.jar:na] at akka.dispatch.MonitorableThreadFactory $ AkkaForkJoinWorkerThread.blockOn(ThreadPoolBuilder.scala:167)〜[akka-actor_2.11.jar:na] 在scala.concurrent.package $ .blocking(package.scala:123)〜[scala-library-2.11.8.jar:na] 在controllers.Assets $ .controllers $ Assets $$ assetInfoFromResource(Assets.scala:282)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.Assets $ .assetInfo(Assets.scala:294)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.Assets $ .assetInfoForRequest(Assets.scala:302)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetsBuilder $$ anonfun $ 17.apply(Assets.scala:441)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetsBuilder $$ anonfun $ 17.apply(Assets.scala:440)〜[play_2.11-2.4.3.jar:2.4.3] 在scala.Option.map(Option.scala:146)〜[scala-library-2.11.8.jar:na] 在controllers.AssetsBuilder.controllers $ AssetsBuilder $$ assetAt(Assets.scala:440)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetsBuilder $$ anonfun $ versioned $ 1.apply(Assets.scala:419)〜[play_2.11-2.4.3.jar:2.4.3] 在controllers.AssetsBuilder $$ anonfun $ versioned $ 1.apply(Assets.scala:409)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $ .invokeBlock(Action.scala:533)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.Action $ .invokeBlock(Action.scala:530)〜[play_2.11-2.4.3.jar:2.4.3] at play.api.mvc.ActionBuilder $$ anon $ 1.apply(Action.scala:493)〜[play_2.11-2.4.3.jar:2.4.3] ...省略了18个常见帧
答案 0 :(得分:0)
我发现了问题:有人放了一个jar文件:commons-codec-1.4.jar所以它可以被play引用。这个在整个游戏应用程序中破坏了。