xsbt-web-plugin 中 jetty:start 和 jetty:quickstart 有什么区别
What is the difference between jetty:start and jetty:quickstart in xsbt-web-plugin
我是 运行 一个使用 sbt 1.3.8 构建的 lift 3.3.0 上的 scala 2.11.12 应用程序。我试过 xsbt-web-plugin 的 4.0.3 和 4.2.0。当我使用 jetty:start 时,我的应用程序启动正常,但当我使用 jetty:quickstart 时,它无法启动 - 我在浏览器中收到 500 错误,当我在控制台中检查应用程序日志时,我看到 java.lang.NoSuchMethodError:'int javax.servlet.http.HttpServletResponse.getStatus()' 导致码头实例返回 500。
** 编辑我在我的日志中更进一步
quickstart 的运行方式和 start 的运行方式有什么区别?我想不出问题。
下面是我的 build.sbt 以防有帮助。在其下方,我在 jetty:quickstart 中包含请求的控制台日志,显示我收到的错误。我没有收到 jetty:start.
的错误
** 编辑 2
Ive jun jetty:start 然后显示更新,jetty:quickstart 然后显示更新。
他们都有 javax.servlet:servlet-api:2.5:default 作为依赖。但是 jetty:start 工作正常并启动容器,而 jetty:quickstart 无法初始化容器。我无法理解为什么一个有效而一个失败 - 在我看来两者都应该失败。
** edit 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:quickstart
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.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.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
命令均来自 Jetty 的 xsbt-web-plugin. Note that jetty:quickstart
is unrelated to the Quickstart Webapps 功能。
两者之间的主要区别在于 start
构建项目的完整包而 quickstart
不构建。使用 quickstart
,不会创建 .war 文件,您的 类 不会打包在 .jar 文件等
使用 quickstart
,Jetty 运行 使用由 sbt 管理的项目的 运行time 类路径。使用 start
,Jetty 是 运行 只有你的项目的包,它包含的依赖项作为 .jar 文件。这些可能不同,因为 sbt 的 运行time 类路径将包含 provided
范围内的依赖项,而你的包不会。这就是为什么一个为您工作而另一个不为您工作的原因。
你的错误:
java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()'
表示您的类路径上的 servlet-api
.jar 与 Jetty 期望的之间有一个 version conflict。您项目的一个或多个依赖项必须对旧版本 servlet-api
.
具有传递依赖性
inspect the dependency tree有多种方法。使用 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 版本来说太旧了。
在 sbt 中有多种方法可以 exclude transitive dependencies。通过将 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"
我是 运行 一个使用 sbt 1.3.8 构建的 lift 3.3.0 上的 scala 2.11.12 应用程序。我试过 xsbt-web-plugin 的 4.0.3 和 4.2.0。当我使用 jetty:start 时,我的应用程序启动正常,但当我使用 jetty:quickstart 时,它无法启动 - 我在浏览器中收到 500 错误,当我在控制台中检查应用程序日志时,我看到 java.lang.NoSuchMethodError:'int javax.servlet.http.HttpServletResponse.getStatus()' 导致码头实例返回 500。
** 编辑我在我的日志中更进一步
quickstart 的运行方式和 start 的运行方式有什么区别?我想不出问题。
下面是我的 build.sbt 以防有帮助。在其下方,我在 jetty:quickstart 中包含请求的控制台日志,显示我收到的错误。我没有收到 jetty:start.
的错误** 编辑 2 Ive jun jetty:start 然后显示更新,jetty:quickstart 然后显示更新。 他们都有 javax.servlet:servlet-api:2.5:default 作为依赖。但是 jetty:start 工作正常并启动容器,而 jetty:quickstart 无法初始化容器。我无法理解为什么一个有效而一个失败 - 在我看来两者都应该失败。
** edit 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:quickstart
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.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.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
命令均来自 Jetty 的 xsbt-web-plugin. Note that jetty:quickstart
is unrelated to the Quickstart Webapps 功能。
两者之间的主要区别在于 start
构建项目的完整包而 quickstart
不构建。使用 quickstart
,不会创建 .war 文件,您的 类 不会打包在 .jar 文件等
使用 quickstart
,Jetty 运行 使用由 sbt 管理的项目的 运行time 类路径。使用 start
,Jetty 是 运行 只有你的项目的包,它包含的依赖项作为 .jar 文件。这些可能不同,因为 sbt 的 运行time 类路径将包含 provided
范围内的依赖项,而你的包不会。这就是为什么一个为您工作而另一个不为您工作的原因。
你的错误:
java.lang.NoSuchMethodError: 'int javax.servlet.http.HttpServletResponse.getStatus()'
表示您的类路径上的 servlet-api
.jar 与 Jetty 期望的之间有一个 version conflict。您项目的一个或多个依赖项必须对旧版本 servlet-api
.
inspect the dependency tree有多种方法。使用 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 版本来说太旧了。
在 sbt 中有多种方法可以 exclude transitive dependencies。通过将 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"