Java

Shibboleth IdP 不會從 Jetty 9.3 開始

  • December 7, 2017

我一直在按照本指南在 Jetty 9.3.22(帶有 Oracle JDK 8u151 的 Ubuntu Server 16.04)上安裝 Shibboleth Identity Provider 3.3.2。

https://my.server.ip/idp我收到 503 錯誤 ( Service Unavailable)。

  • Jetty Home:(/opt/jetty/jetty-distribution符號連結到 jetty-distribution-9.3.22.v20171030同一目錄中)
  • 碼頭基地:/opt/jetty/jetty-base
  • Shibboleth 安裝:/opt/shibboleth-idp

我創建了一個jetty使用者,並使用setuid綁定到埠 80 和 443。jetty:jetty擁有和下的所有/opt/jetty/內容/opt/shibboleth-idp

下面的日誌和配置,儘管配置主要是從說明中複製/粘貼。我還按照說明配置了 logback,但這似乎有效,因此除非必要,否則我不會包含配置。

我還應該注意,我還沒有開始配置 Shibboleth。據我了解,我至少應該仍然能夠執行此命令並獲得一些結果:

root@shib:/opt/shibboleth-idp/bin# ./status.sh 
(http://localhost/idp/status) Server returned HTTP response code: 503 for URL: http://localhost/idp/status

甚至在導航到任何 URL 之前,我都會在/opt/jetty/jetty-base/log/jetty.log啟動碼頭服務時得到這個:

   19:55:27.983 - WARN [org.eclipse.jetty.webapp.WebAppContext:531] - Failed startup of context o.e.j.w.WebAppContext@23a5fd2{/idp,[file:///opt/jetty/jetty-base/tmp/jetty-0.0.0.0-80-idp.war-_idp-any-1528794646328615543.dir/webinf/, jar:file:///opt/shibboleth-idp/war/idp.war!/],UNAVAILABLE}{/opt/shibboleth-idp/war/idp.war}
   org.eclipse.jetty.util.MultiException: Multiple exceptions
           at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:539)
           at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:448)
           at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:496)
           at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1363)
           at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)
           at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)
           at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)
           at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
           at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
           at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
           at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
           at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
           at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
           at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:458)
           at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
           at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
           at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
           at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
           at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
           at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
           at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
           at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
           at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
           at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
           at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
           at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
           at org.eclipse.jetty.server.Server.start(Server.java:422)
           at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
           at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
           at org.eclipse.jetty.server.Server.doStart(Server.java:389)
           at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
           at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1540)
           at java.security.AccessController.doPrivileged(Native Method)
           at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1462)
           Suppressed: java.lang.NullPointerException: null
                   at org.eclipse.jetty.util.MultiReleaseJarFile.<init>(MultiReleaseJarFile.java:92)
                   at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:926)
                   at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:890)
                   at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:164)
                   at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:551)
                   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
                   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
                   at java.lang.Thread.run(Thread.java:748)
           Suppressed: java.lang.NullPointerException: null
                   at org.eclipse.jetty.util.MultiReleaseJarFile.<init>(MultiReleaseJarFile.java:92)
                   at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:926)
                   at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:890)
                   at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:164)
                   at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:551)
                   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
                   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
                   at java.lang.Thread.run(Thread.java:748)
   Caused by: java.lang.NullPointerException: null
           at org.eclipse.jetty.util.MultiReleaseJarFile.<init>(MultiReleaseJarFile.java:92)
           at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:926)
           at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:890)
           at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:164)
           at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:551)
           at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
           at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
           at java.lang.Thread.run(Thread.java:748)
   19:55:27.989 - INFO [org.eclipse.jetty.server.AbstractConnector:278] - Started ServerConnector@16f7c8c1{HTTP/1.1,[http/1.1]}{0.0.0.0:80}
   19:55:28.273 - INFO [org.eclipse.jetty.util.ssl.SslContextFactory:290] - x509=X509@1e683a3e(1,h=[example.com],w=[example.com]) for SslContextFactory@2053d869(file:///opt/shibboleth-idp/credentials/idp-browser.p12,null)
   19:55:28.335 - INFO [org.eclipse.jetty.server.AbstractConnector:278] - Started ServerConnector@2f0a87b3{SSL,[ssl, http/1.1]}{0.0.0.0:443}
   19:55:28.335 - INFO [org.eclipse.jetty.server.Server:414] - Started @4819ms

/etc/default/jetty

JETTY_HOME=/opt/jetty/jetty-distribution
JETTY_BASE=/opt/jetty/jetty-base
JETTY_LOGS=/var/log/jetty

/opt/jetty/jetty-base/start.ini

# To disable the warning message, comment the following line
--module=home-base-warning

# ---------------------------------------
# Module: ext
--module=ext

# ---------------------------------------
# Module: resources
--module=resources

# ---------------------------------------
# Module: server
--module=server

# ---------------------------------------
# Module: http
--module=http

# ---------------------------------------
# Module: deploy
--module=deploy

# ---------------------------------------
# Module: jsp
--module=jsp

# ---------------------------------------
# Module: websocket
--module=websocket

# ---------------------------------------
# Module: jstl
--module=jstl

# ---------------------------------------
# Module: annotations
--module=annotations

# ---------------------------------------
# Module: logging
--module=logging

# ---------------------------------------
# Module: requestlog
--module=requestlog

# ---------------------------------------
# Module: servlets
--module=servlets

# ---------------------------------------
# Module: plus
--module=plus

# ---------------------------------------
# Mwdule: http-forwarded
--module=http-forwarded

--exec
--skip-file-validation=ssl
-XX:+UseG1GC
-Xmx1500m
-Djava.io.tmpdir=tmp
-Djava.library.path=libsetuid-linux
-Didp.home=/opt/shibboleth-idp
-Djava.security.egd=file:/dev/urandom

/opt/jetty/jetty-base/webapps/idp.xml

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 <Set name="war"><SystemProperty name="idp.home"/>/war/idp.war</Set>
 <Set name="contextPath">/idp</Set>
 <Set name="extractWAR">false</Set>
 <Set name="copyWebDir">false</Set>
 <Set name="copyWebInf">true</Set>
</Configure>

我今天設法解決了這個問題。經過更多研究,這個 Jetty 錯誤似乎與我的問題有關。該更新檔沒有發布 Jetty 9.3.22 版本,所以我從原始碼建構了最新的 9.3.x 分支,我現在正在使用它。

所以,就是:

git clone https://github.com/eclipse/jetty.project.git
cd jetty.project
git checkout --track origin/jetty-9.3.x
mvn clean install

建構後,複製並提取./jetty-distribution/target/jetty-distribution-9.3.23-SNAPSHOT.tar.gz到您想要的位置。

引用自:https://serverfault.com/questions/886948