gpt4 book ai didi

scala - 在 Scalatra 中获取 "No lifecycle class found!"

转载 作者:行者123 更新时间:2023-12-02 05:36:53 25 4
gpt4 key购买 nike

我正在尝试使用 container:start 命令通过 sbt 运行 scalatra,但我得到“断言失败:找不到生命周期类!”消息,这是我使用“最后一个容器:启动”获得的完整堆栈跟踪:

Blockquote last container:restart java.lang.AssertionError: assertion failed: No lifecycle class found! at scala.Predef$.assert(Predef.scala:179) at org.scalatra.servlet.ScalatraListener.probeForCycleClass(ScalatraListener.scala:50) at org.scalatra.servlet.ScalatraListener.configureCycleClass(ScalatraListener.scala:64) at org.scalatra.servlet.ScalatraListener.contextInitialized(ScalatraListener.scala:23) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:446) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:792) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:296) at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1359) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1352) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125) at org.eclipse.jetty.server.Server.start(Server.java:358) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) at org.eclipse.jetty.server.Server.doStart(Server.java:325) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at com.earldouglas.xsbtwebplugin.Jetty9Runner.start(Jetty9Runner.scala:122) at com.earldouglas.xsbtwebplugin.Container$$anonfun$containerSettings$11.apply(Container.scala:77) at com.earldouglas.xsbtwebplugin.Container$$anonfun$containerSettings$11.apply(Container.scala:74) at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35) at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42) at sbt.std.Transform$$anon$4.work(System.scala:64) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) at sbt.Execute.work(Execute.scala:244) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) [error] (container:restart) java.lang.AssertionError: assertion failed: No lifecycle class found! Blockquote



这是我的 LifeCycle 文件名为:“ScalatraBootstrap.scala”,它的内容是:
import org.Server.Controllers.Controller2
import org.scalatra.example.Server._
import org.scalatra.LifeCycle
import javax.servlet.ServletContext

class ScalatraBootstrap extends LifeCycle {
implicit val swagger = new FlowSwagger
override

def init(context: ServletContext) {
context.mount(new Controller1, "/*") context.mount(new Controller2, "/string1/*") context.mount(new Controller3, "/string2/*")
}
}

最佳答案

ScalatraBootstrap.scala应该在顶级包装中,没有任何 package姓名。

删除您在 ScalatraBootstrap.scala 中的任何包声明文件。

关于scala - 在 Scalatra 中获取 "No lifecycle class found!",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26418169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com