カスタマイズされた JBoss Portal のドメイン モードで SSO レプリケーションをセットアップしようとしています。domain.xml に次の変更を加えました。
ha-profile に属するサーバー グループに、以下を追加しました。
<system-properties> <property name="exo.profiles" value="cluster"/> <property name="gatein.jcr.config.type" value="cluster"/> <property name="gatein.jcr.index.changefilterclass" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.LocalIndexChangesFilter"/>
domain.xml の ha プロファイルへ
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> <sso cache-container="web" cache-name="sso"/> </virtual-server> </subsystem>
プリンシパルの複製に問題があります。ユーザーから情報を取得しようとすると、NPE が発生します。これはログのスニペットです。
########### log in @ server1 ########### 11:27:41,430 TRACE [org.jboss.as.web.sso] (ajp-/x.x.x.1:8009-4) Registering sso id 'qY0hc42eF1DFFXqtDHzJLse9' for user 'user@domain.com' with auth type 'FORM'
11:27:41,432 TRACE [org.jboss.as.clustering.web.sso.infinispan.SSOClusterManager] (ajp-/x.x.x.1:8009-4) Registering SSO qY0hc42eF1DFFXqtDHzJLse9 in clustered cache
########### shutdown @ server1 ########### 11:28:14,794 INFO [org.apache.coyote.http11] (MSC service thread 1-4) JBWEB003075: Coyote HTTP/1.1 pausing on: http-/x.x.x.1:8080
########### sso update @ server2 ###########
11:27:41,447 TRACE [org.jboss.as.clustering.web.sso.infinispan.SSOClusterManager] (OOB-18,shared=udp) received a credentials modified message for SSO qY0hc42eF1DFFXqtDHzJLse9
11:27:41,462 TRACE [org.jboss.as.clustering.web.sso.infinispan.SSOClusterManager] (OOB-18,shared=udp) received a session modified message for SSO qY0hc42eF1DFFXqtDHzJLse9
11:28:15,577 TRACE [org.jboss.as.clustering.web.sso.infinispan.SSOClusterManager] (OOB-20,shared=udp) received a session modified message for SSO qY0hc42eF1DFFXqtDHzJLse9
########### log in @ server2 ########### 11:28:15,578 TRACE [org.jboss.as.web.sso] (OOB-20,shared=udp) Notified that SSO qY0hc42eF1DFFXqtDHzJLse9 is empty
11:28:35,530 TRACE [org.jboss.as.web.sso] (ajp-/x.x.x.2:8009-4) Checking for cached principal for qY0hc42eF1DFFXqtDHzJLse9
11:28:35,532 TRACE [org.jboss.as.web.sso] (ajp-/x.x.x.2:8009-4) Found cached principal 'NULL' with auth type 'FORM'
フェイルオーバー後にページを更新すると、次のエラーが発生します。
11:28:44,054 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[customapp].[jsp]] (ajp-/x.x.x.2:8009-4) JBWEB000236: Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException at org.apache.jsp.WEB_002dINF.jsp.banners.customappbanner_jsp._jspService(customappbanner_jsp.java:148)
これは、このスニペットの「else」部分から生成されます:
<% if(request.getUserPrincipal() == null) {%>
<a href="/portal/login" id="sign-in" class="header-link" rel="nofollow">Login</a>
<% } else { %>
<ul class="header-link">
<li class="hidden-xs"><i class="icons user"></i><%= request.getUserPrincipal().getName().toString() %></li>
どんなヒントでも大歓迎です。また、配布可能なタグは web.xml にあります。
ありがとう。