sbt、码头和类路径
我正在尝试将 SBT 与 xsbt-web-plugin 一起使用。 按照项目网站上的说明进行操作,但继续得到以下信息(抱歉长度太长)
sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
at sbt.JettyRunner.runError(WebApp.scala:72)
at sbt.JettyRunner.apply(WebApp.scala:62)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$$anon$1.process(State.scala:60)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/webapp/WebAppClassLoader
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
at sbt.JettyRunner.apply(WebApp.scala:57)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$$anon$1.process(State.scala:60)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppClassLoader
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sbt.classpath.DualLoader.loadClass(DualLoader.scala:29)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sbt.classpath.LazyFrameworkLoader.doLoadClass(ClassLoaders.scala:122)
at sbt.classpath.LoaderBase.loadClass(ClassLoaders.scala:21)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
at sbt.JettyRunner.apply(WebApp.scala:57)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$$anon$1.process(State.scala:60)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
[error] Use 'last' for the full log.
这是我的配置: 在project/plugins.sbt中:
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
addSbtPlugin("com.github.siasia" %% "xsbt-web-plugin" % "0.1.2")
libraryDependencies += "org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"
这是我的build.sbt:
name := "Project Manager"
scalaVersion := "2.9.1"
resolvers += "repo.codahale.com" at "http://repo.codahale.com"
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % "2.0.1",
"org.scalatra" %% "scalatra-scalate" % "2.0.1",
"javax.servlet" % "servlet-api" % "2.4",
"org.slf4j" % "slf4j-simple" % "1.6.2",
"postgresql" % "postgresql" % "9.0-801.jdbc4",
"com.codahale" % "jerkson_2.9.1" % "0.4.2",
"org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"
)
seq(webSettings :_*)
任何帮助将不胜感激!
I'm trying to use the SBT with the xsbt-web-plugin.
Followed the instructions on the projects website but continue to get the following (sorry for the length)
sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
at sbt.JettyRunner.runError(WebApp.scala:72)
at sbt.JettyRunner.apply(WebApp.scala:62)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$anon$1.process(State.scala:60)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/webapp/WebAppClassLoader
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
at sbt.JettyRunner.apply(WebApp.scala:57)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$anon$1.process(State.scala:60)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppClassLoader
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sbt.classpath.DualLoader.loadClass(DualLoader.scala:29)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sbt.classpath.LazyFrameworkLoader.doLoadClass(ClassLoaders.scala:122)
at sbt.classpath.LoaderBase.loadClass(ClassLoaders.scala:21)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
at sbt.JettyRunner.apply(WebApp.scala:57)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at com.github.siasia.WebPlugin$anonfun$10.apply(WebPlugin.scala:141)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$anonfun$command$1$anonfun$apply$1.apply(Command.scala:33)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1$anonfun$apply$1.apply(Main.scala:86)
at sbt.State$anon$1.process(State.scala:60)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.MainLoop$anonfun$next$1.apply(Main.scala:86)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:86)
at sbt.MainLoop$.run(Main.scala:81)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:75)
at sbt.MainLoop$anonfun$runLogged$1.apply(Main.scala:72)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runLogged(Main.scala:72)
at sbt.MainLoop$.runLogged(Main.scala:62)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
[error] Use 'last' for the full log.
Here's my config:
In project/plugins.sbt:
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
addSbtPlugin("com.github.siasia" %% "xsbt-web-plugin" % "0.1.2")
libraryDependencies += "org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"
Here's my build.sbt:
name := "Project Manager"
scalaVersion := "2.9.1"
resolvers += "repo.codahale.com" at "http://repo.codahale.com"
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % "2.0.1",
"org.scalatra" %% "scalatra-scalate" % "2.0.1",
"javax.servlet" % "servlet-api" % "2.4",
"org.slf4j" % "slf4j-simple" % "1.6.2",
"postgresql" % "postgresql" % "9.0-801.jdbc4",
"com.codahale" % "jerkson_2.9.1" % "0.4.2",
"org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"
)
seq(webSettings :_*)
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来该插件的作者错过了在 用法 部分中添加 Jetty 依赖项的文档。但是,如果您查看 Running Lift,您会看到Jetty 是外部必需的依赖项:
Looks like the author of the plugin has missed adding the Jetty dependency in the Usage section of the documentation. However, if you look in the Running Lift, you'll see that Jetty is an externally required dependency:
这个问题实际上与jetty需要成为依赖项并且jetty 8尚不支持这一事实有关。
最终配置如下所示:
感谢您的帮助。
The issue was actually related to the fact that jetty needs to be a dependency and that jetty 8 isn't yet supported.
The final config looks like this:
Thanks for your help.
尝试将所有 lib 和主类复制到 jar/war 的根目录中,并将类路径设置为 lib/*。确保 lib 包含所有 jetty jar。这对我有用=>
java -cp myway;"lib/*" mainpackage.main
Try to copy all the lib and main class to the root directory of your jar/war and set the classpath to lib/*. Make sure lib contains all the jetty jars. This worked for me =>
java -cp myway;"lib/*" mainpackage.main