I am trying to run scalatra with sbt using container:start command but i get "assertion failed: No lifecycle class found!" message , this is the full stack trace i got with "last container:start" :
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
This is my LifeCycle file is called :"ScalatraBootstrap.scala" and it's content is:
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
should be in top package without any package
name.
remove any package declerations you have in the ScalatraBootstrap.scala
file.