Apache Pluto 是 JSR 168 Portlet 規範參考實現,Apache Geronimo 是認證的開源 J2EE 應用服務器。雖 Geronimo 未預集成門戶服務,但通過 SharedLib 共享庫與部署計劃,可將 Pluto 容器與驅動器部署於 Geronimo,構建 100% 開源的門戶開發測試環境。
Pluto 門戶應用在 Tomcat 中作為子應用部署,但 Geronimo 每個 Web 應用獨立類載入器,導致 Portlet API、Pluto 容器類重複載入產生 ClassNotFoundException。解決方案:利用 Geronimo sharedlib 服務,將共用類庫載入統一類載入器。
複製以下檔案至 Geronimo 共享目錄:
PLUTO_HOME/webapps/pluto/WEB-INF/classes/*.properties → GERONIMO_HOME/var/shared/classespluto-*.jar, portlet-api-1.0.jar, castor-*.jar, commons-*.jar → GERONIMO_HOME/var/shared/lib確保 geronimo/sharedlib/1.1.1/car 服務啟動。
<web-app xmlns="https://geronimo.apache.org/xml/ns/web" ...>
<sys:environment>
<dependencies>
<dependency><artifactId>sharedlib</artifactId></dependency>
</dependencies>
</sys:environment>
<security-realm-name>pluto-properties-file-realm</security-realm-name>
<security>...</security> // 映射 tomcat 角色至安全域
<tomcat:cross-context/> // 允許跨應用調度 Portlet
</web-app>
# 從二進制版建立 WAR jar cvf pluto.war -C PLUTO_HOME/webapps/pluto . # 部署 deploy --user system deploy pluto.war geronimo-web-pluto.xml
GenericPortlet,實現 doView、processAction。PortletServlet 包裝器,映射 URL 模式,宣告 TLD。<web-app ...>
<sys:environment>
<dependencies><dependency><artifactId>sharedlib</artifactId></dependency></dependencies>
</sys:environment>
</web-app>
deploy buyticket.war geronimo-web-app.xml)。https://localhost:8080/pluto/portal/adminportletapp) 註冊 Portlet 實體、定義頁面佈局、指派 Portlet 至區域,更新 portletentityregistry.xml、pageregistry.xml。訪問 https://localhost:8080/pluto/portal,點擊應用連結進入購票頁面,選擇比賽、輸入姓名信用卡,提交顯示購票成功。
Pluto 提供輕量級 JSR 168 相容測試環境,Geronimo 提供豐富企業級服務(資料庫、訊息、目錄)。兩者結合,兼得門戶標準相容性與應用服務器完整功能,是開源門戶開發的理想組合。Jetspeed、Liferay 等重量級門戶同樣可部署於 Geronimo,但 Pluto 更適合輕量開發測試。