我在用sbt 1.3.8构建的lift 3.3.0上运行一个scala 2.11.12应用程序。我已经尝试了4.0.3和4.2.0的xsbt-web-plugin。当我使用jetty:start时,我的应用程序启动得很好,但当我使用jetty:quickstart时,它却无法启动--我在浏览器中得到一个500的错误,当我在控制台中检查应用程序日志时,我看到java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()',这导致jetty实例返回一个500。
** 编辑我又回到了我的日志中。
quickstart运行和start运行有什么区别?我想不通这个问题。
下面是我的build.sbt,以备不时之需。下面是我在jetty:quickstart中请求的控制台日志,显示了我得到的错误。我在jetty:start中没有得到这个错误。
** 编辑 2我已经把 jetty:start then show update 和 jetty:quickstart then show update.它们都有 javax.servlet:servlet-api:2.5:default 作为依赖。但是jetty:start可以正常工作并启动容器,而jetty:quickstart却无法初始化容器。我不明白为什么一个工作,一个失败--在我看来两个都应该失败。
** 编辑3 我知道为什么servlet-api 2.5会出现,并更新了paypal的依赖关系来解决这个问题。我还是很想知道为什么 jetty:start 可以工作,而 jetty:quickstart 却不可以--它们似乎都应该失败。
build.sbt
name := "knot-core"
organization := "com.postrope"
version := "0.0.1"
scalaVersion := "2.11.12"
excludeFilter := HiddenFileFilter -- ".ebextensions"
resolvers ++= Seq(
"Sonatype scala-tools releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype scala-tools snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
libraryDependencies ++= {
val liftVersion = "3.3.0"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"junit" % "junit" % "4.7" % "test",
"ch.qos.logback" % "logback-core" % "1.0.0",
"ch.qos.logback" % "logback-classic" % "1.0.0",
"mysql" % "mysql-connector-java" % "8.0.19",
"org.ccil.cowan.tagsoup" % "tagsoup" % "1.2",
"net.liftmodules" %% "paypal_3.0" % "1.3.0",
"com.paypal.sdk" % "adaptivepaymentssdk" % "2.6.110",
"com.paypal.sdk" % "adaptiveaccountssdk" % "2.4.106",
"org.apache.solr" % "solr-solrj" % "4.4.0",
"org.imgscalr" % "imgscalr-lib" % "4.2",
"org.jsoup" % "jsoup" % "1.7.3",
"com.amazonaws" % "aws-java-sdk" % "1.7.3",
"org.seleniumhq.selenium" % "selenium-java" % "3.9.1",
"org.seleniumhq.selenium" % "selenium-chrome-driver" % "3.9.1",
"org.scalatest" %% "scalatest" % "3.1.1" % "test",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
"net.databinder" %% "dispatch-core" % "0.8.10",
"net.databinder" %% "dispatch-http" % "0.8.10",
"net.databinder" %% "dispatch-oauth" % "0.8.10",
"net.databinder" %% "dispatch-http-json" % "0.8.10"
)
}
enablePlugins(JettyPlugin)
javaOptions in Jetty ++= Seq(
"-Xdebug",
"-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"
)
//jRebel class reload support
Seq(JRebelPlugin.jrebelSettings: _*)
jrebelWebLinks += (sourceDirectory in Compile).value / "webapp"
jrebelEnabled := true
javaOptions in Jetty ++= Seq(
"-agentpath:C:\\Users\\drewb\\tools\\jrebel-2020.2.0\\lib\\jrebel64.dll",
)
在jetty:faststart中出错
02:03:55.221 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - REQUEST for //localhost:8080/ on HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=1}
GET //localhost:8080/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: _ga=GA1.1.498072716.1587178043; _gid=GA1.1.223715266.1587738288; JSESSIONID=node01b1y37p1yogb5tgcxs7c0pofr0.node0; _gat=1
02:03:55.221 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=2} onContentComplete
02:03:55.222 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=3} onRequestComplete
02:03:55.222 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpInput - HttpInputOverHTTP@243824e[c=0,q=0,[0]=null,s=STREAM] addContent EOF
02:03:55.222 [qtp101874302-67] DEBUG o.e.jetty.server.HttpConnection - HttpConnection@70d9094a::SocketChannelEndPoint@7785c24d{/0:0:0:0:0:0:0:1:55305<->/0:0:0:0:0:0:0:1:8080,OPEN,fill=-,flush=-,to=19/30000}{io=0/0,kio=0,kro=1}->HttpConnection@70d9094a[p=HttpParser{s=END,0 of -1},g=HttpGenerator@43f6ae01{s=START}]=>HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=3} parsed true HttpParser{s=END,0 of -1}
02:03:55.223 [qtp101874302-67] DEBUG o.e.jetty.server.HttpConnection - releaseRequestBuffer HttpConnection@70d9094a::SocketChannelEndPoint@7785c24d{/0:0:0:0:0:0:0:1:55305<->/0:0:0:0:0:0:0:1:8080,OPEN,fill=-,flush=-,to=19/30000}{io=0/0,kio=0,kro=1}->HttpConnection@70d9094a[p=HttpParser{s=END,0 of -1},g=HttpGenerator@43f6ae01{s=START}]=>HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=4}
02:03:55.224 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=IDLE,uri=//localhost:8080/,age=5} handle //localhost:8080/
02:03:55.224 [qtp101874302-67] DEBUG o.e.jetty.server.HttpChannelState - handling HttpChannelState@69b6a9e2{s=IDLE a=NOT_ASYNC i=true r=IDLE w=false}
02:03:55.227 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=DISPATCHED,uri=//localhost:8080/,age=8} action DISPATCH
02:03:55.229 [qtp101874302-67] DEBUG org.eclipse.jetty.server.Server - REQUEST GET / on HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=DISPATCHED,uri=//localhost:8080/,age=10}
02:03:55.229 [qtp101874302-67] DEBUG o.e.j.server.handler.ContextHandler - scope null||/ @ o.e.j.w.WebAppContext@1a45193b{/,file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/,UNAVAILABLE}{file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/}
02:03:55.232 [qtp101874302-67] WARN org.eclipse.jetty.server.HttpChannel - /
java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()'
at org.eclipse.jetty.server.handler.ErrorHandler.doError(ErrorHandler.java:138) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:74) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Response.sendError(Response.java:454) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Response.sendError(Response.java:391) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.checkContext(ContextHandler.java:1108) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1149) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Server.handle(Server.java:494) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
02:03:55.232 [qtp101874302-67] DEBUG o.e.jetty.server.HttpChannelState - onError HttpChannelState@69b6a9e2{s=DISPATCHED a=NOT_ASYNC i=true r=IDLE w=false} {}
02:03:55.232 [qtp101874302-67] DEBUG o.e.jetty.server.HttpChannelState - unhandle HttpChannelState@69b6a9e2{s=THROWN a=NOT_ASYNC i=true r=IDLE w=false}
02:03:55.232 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=DISPATCHED,uri=//localhost:8080/,age=13} action ERROR_DISPATCH
02:03:55.234 [qtp101874302-67] DEBUG org.eclipse.jetty.server.Server - ERROR GET / on HttpChannelOverHttp@c1f8711{r=1,c=false,c=false/false,a=DISPATCHED,uri=//localhost:8080/,age=15}
02:03:55.234 [qtp101874302-67] DEBUG o.e.j.server.handler.ContextHandler - scope null||/ @ o.e.j.w.WebAppContext@1a45193b{/,file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/,UNAVAILABLE}{file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/}
02:03:55.234 [qtp101874302-67] DEBUG o.e.j.server.handler.ContextHandler - context=||/ @ o.e.j.w.WebAppContext@1a45193b{/,file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/,UNAVAILABLE}{file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/}
02:03:55.236 [qtp101874302-67] DEBUG o.e.j.servlet.ErrorPageErrorHandler - getErrorPage(GET /) => error_page=null (from global default)
02:03:55.236 [qtp101874302-67] DEBUG o.e.j.server.handler.ErrorHandler - No Error Page mapping for request(GET /) (using default)
02:03:55.237 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - Could not perform ERROR dispatch, aborting
java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()'
at org.eclipse.jetty.server.handler.ErrorHandler.doError(ErrorHandler.java:138) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:74) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Response.sendError(Response.java:454) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.AbstractHandler.doError(AbstractHandler.java:93) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:1301) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:42003) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:190) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Server.handle(Server.java:494) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:429) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
02:03:55.238 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - sendResponse info=null content=HeapByteBuffer@47b52cca[p=0,l=0,c=0,r=0]={<<<>>>} complete=false committing=true callback=Blocker@4483efeb{null}
02:03:55.238 [qtp101874302-67] DEBUG org.eclipse.jetty.server.HttpChannel - COMMIT for / on HttpChannelOverHttp@c1f8711{r=1,c=true,c=false/false,a=DISPATCHED,uri=//localhost:8080/,age=19}
500 null HTTP/1.1
容器初始化错误
11:21:49.793 [main] DEBUG o.eclipse.jetty.webapp.WebAppContext - isServerClass==true class org.eclipse.jetty.annotations.ServletContainerInitializersStarter
11:21:49.793 [main] WARN o.e.j.u.component.AbstractLifeCycle - FAILED ServletContainerInitializersStarter@285f09de{FAILED}: java.lang.NoSuchMethodError: 'javax.servlet.descriptor.JspConfigDescriptor javax.servlet.ServletContext.getJspConfigDescriptor()'
java.lang.NoSuchMethodError: 'javax.servlet.descriptor.JspConfigDescriptor javax.servlet.ServletContext.getJspConfigDescriptor()'
at org.apache.jasper.servlet.TldScanner.scanJspConfig(TldScanner.java:158) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:102) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:141) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:64) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1443) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1407) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:821) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:276) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Server.start(Server.java:407) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.Server.doStart(Server.java:371) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.runner.Runner.run(Runner.java:520) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.runner.Runner.main(Runner.java:565) ~[jetty-runner-9.4.20.v20190813.jar:9.4.20.v20190813]
11:21:49.794 [main] WARN o.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@4bd1f8dd{/,file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/,UNAVAILABLE}{file:///C:/Users/drewb/IdeaProjects/knot-alpha/src/main/webapp/
该 jetty:start
和 jetty:quickstart
命令都来自于 xsbt-web-plugin. 注意到 jetty:quickstart
是无关紧要的 快速启动Webapps Jetty的特点。
两者的主要区别在于 start
构建一个完整的项目包,并 quickstart
不。 随着 quickstart
,没有 .战争 文件的创建,你的类并没有被打包成一个 .jar 文件等。
随着 quickstart
Jetty是使用你的项目的运行时classpath运行的,由sbt管理。 有了 start
在运行Jetty时,只有你的项目包和它所包含的依赖关系,如 .jar 文件。 这些文件可能会有所不同,因为sbt的运行时classpath会包含在 provided
的范围,而你的包则不会。 这就是为什么一个对你有用,而另一个却没用。
你的错误。
java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()'
表明你有一个 版本冲突 之间 servlet-api
.jar 和 Jetty 期待的那个版本。 你的一个或多个项目的依赖关系必须有一个旧版本的 servlet-api
.
有多种方法 检查依赖树. 使用Coursier,我看到你的两个Paypal库都依赖于 servlet-api
2.5:
├─ com.paypal.sdk:adaptiveaccountssdk:2.4.106
│ └─ com.paypal.sdk:paypal-core:1.4.4
│ ├─ com.google.code.gson:gson:2.2.2 -> 2.8.2 (possible incompatibility)
│ ├─ commons-codec:commons-codec:1.6 -> 1.11 (possible incompatibility)
│ └─ javax.servlet:servlet-api:2.5
├─ com.paypal.sdk:adaptivepaymentssdk:2.6.110
│ └─ com.paypal.sdk:paypal-core:1.4.4
│ ├─ com.google.code.gson:gson:2.2.2 -> 2.8.2 (possible incompatibility)
│ ├─ commons-codec:commons-codec:1.6 -> 1.11 (possible incompatibility)
│ └─ javax.servlet:servlet-api:2.5
这个需要排除掉,因为它对你使用的Jetty版本来说太老了。
有多种方法可以 排除转属关系 在SDT中。 通过添加 exclude("javax.servlet", "servlet-api")
到您的两个Paypal依赖,我们可以阻止冲突版本的 servlet-api
:
"com.paypal.sdk" % "adaptivepaymentssdk" % "2.6.110" exclude("javax.servlet", "servlet-api"),
"com.paypal.sdk" % "adaptiveaccountssdk" % "2.4.106" exclude("javax.servlet", "servlet-api"),
你还想把最近的一个人加入到。provided
范围,这样你的代码就可以编译了。
libraryDependencies += "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided"