JBoss Portal 2.6.4

Reference Guide

Thomas Heute

Julien Viet

Roy Russo

Release 2.6.4

February 2008


Table of Contents

JBoss Portal - Overview
Feature List
Target Audience
Acknowledgements
1. System Requirements
1.1. Minimum System Requirements
1.2. Supported Operating Systems
1.3. JBoss Application Server
1.4. Databases
1.5. Source building
2. Installation
2.1. The JBoss Portal and JBoss AS Bundle
2.2. Installing the Binary Download
2.2.1. Setting up your Environment
2.2.1.1. Getting the Binary
2.2.1.2. JBoss EAP and JBoss AS Setup
2.2.1.3. Database Setup
2.2.1.4. Datasource Configuration
2.2.2. Deploying JBoss Portal
2.3. Installing from the Sources
2.3.1. Getting the Sources
2.3.2. JBoss EAP and JBoss AS Setup
2.3.2.1. JBoss Application Server Setup
2.3.2.2. Operating System Environment Settings
2.3.3. Building and Deploying from the Sources
2.3.4. Database Setup
2.3.5. Datasource Configuration
2.4. Deploying JBoss Portal
3. Customizing your Installation
3.1. Changing the Port
3.2. Changing the Context Path
3.3. Forcing the Database Dialect
3.3.1. Database Dialect Settings for JBoss Portal
3.3.2. DB Dialect Settings for the CMS Component
3.4. Setting up the Email Service
3.5. Configuring proxy settings
3.6. Disabling Dynamic Proxy Un-wrapping
4. Upgrading JBoss Portal 2.4 to 2.6
4.1. Manual Upgrade
4.1.1. Themes
4.1.2. Updating the Database
4.1.3. Portlet Names
4.1.4. CMS
5. Portlet Primer
5.1. JSR-168 Overview
5.1.1. Portal Pages
5.1.2. Rendering Modes
5.1.3. Window States
5.1.4. Section Status
5.2. Tutorials
5.2.1. Deploying your First Portlet
5.2.1.1. Introduction
5.2.1.2. Package Structure
5.2.1.3. Portlet Classes
5.2.1.4. Application Descriptors
5.2.1.5. Building your portlet
5.2.1.6. Deploying your portlet
5.2.2. A Simple JSP Portlet
5.2.2.1. Introduction
5.2.2.2. Package content
5.2.2.3. Portlet Class
5.2.2.4. JSP files and the portlet taglib
5.2.2.5. Building and deploying your portlet
5.2.3. A simple Sun's JSF Reference Implementation (RI) portlet on JBoss AS 4.2
5.2.3.1. Introduction
5.2.3.2. Package Content
5.2.3.3. Building and deploying your portlet
5.2.4. A simple MyFaces JSF Portlet on JBoss AS 4.2
5.2.4.1. Introduction
5.2.4.2. Package Content
5.2.4.3. Building and deploying your portlet
6. XML Descriptors
6.1. Changes since previous releases
6.1.1. JBoss Portlet DTD
6.1.2. Portlet Instance DTD
6.1.3. Portal Object DTD
6.1.4. JBoss App DTD
6.2. Portlet Descriptors
6.2.1. *-object.xml
6.2.2. portlet-instances.xml
6.2.3. jboss-portlet.xml
6.2.3.1. Injecting Header Content
6.2.3.2. Injecting Services in the portlet context
6.2.3.3. Defining extra portlet information
6.2.3.4. Portlet Session Replication in a Clustered Environment
6.2.4. portlet.xml
6.3. JBoss Portal Descriptors
6.3.1. Datasource Descriptor (portal-*-ds.xml)
6.3.1.1. Obtaining Datasource Descriptors Binary releases
6.3.1.2. Building Datasource Descriptors from Source
6.3.2. Portlet Debugging (jboss-portal.sar/conf/config.xml)
6.3.3. Login to dashboard
6.4. Descriptor Examples
6.4.1. Defining a new portal page
6.4.2. Defining a new portal instance
7. Portal urls
7.1. Introduction
7.2. Accessing a portal
7.3. Accessing a page
7.4. Accessing CMS Content
8. Error handling configuration
8.1. Error types
8.2. Control policies
8.2.1. Policy delegation and cascading
8.2.2. Default policy
8.2.3. Portal policy
8.2.4. Page policy
8.3. Configuration using the XML descriptors
8.3.1. Portal policy properties
8.3.2. Page policy properties
8.4. Handling errors with JSP
8.5. Configuration using the Portal Management Application
9. Content Integration
9.1. Window content
9.2. Content customization
9.3. Content Driven Portlet
9.3.1. Displaying content
9.3.2. Configuring content
9.3.3. Step by step example of a content driven portlet
9.3.3.1. The Portlet skeleton
9.3.3.2. Overriding the dispatch method
9.3.3.3. Utilities methods
9.3.3.4. The editor
9.3.3.5. Viewing content at runtime
9.3.3.6. Hooking the portlet into the portal
9.4. Configuring window content in deployment descriptor
10. Widget Integration
10.1. Introduction
10.2. Widget portlet configuration
11. Portlet Modes
11.1. Admin Portlet Mode
11.1.1. Portlet configuration
11.1.2. Declarative instance security configuration
11.1.3. Instance security configuration with the administration portlet
12. Portal API
12.1. Introduction
12.2. Portal URL
12.3. Portal session
12.4. Portal runtime context
12.5. Portal nodes
12.6. Portal navigational state
12.7. Portal events
12.7.1. Portal node events
12.7.1.1. Portal node event propagation model
12.7.1.2. Portal node event listener
12.7.1.3. Portal node event context
12.7.2. Portal session events
12.7.3. Portal user events
12.8. Examples
12.8.1. UserAuthenticationEvent example
12.8.2. Achieving Inter Portlet Communication with the events mechanism
12.8.3. Link to other pages
13. Clustering Configuration
13.1. Introduction
13.2. Considerations
13.3. JBoss Portal Clustered Services
13.3.1. Portal Session Replication
13.3.2. Hibernate clustering
13.3.3. Identity clustering
13.3.4. CMS clustering
13.4. Setup
13.5. Portlet Session Replication
13.5.1. JBoss Portal configuration
13.5.2. Portlet configuration
13.5.3. Limitations
14. Web Services for Remote Portlets (WSRP)
14.1. Introduction
14.2. Level of support in JBoss Portal
14.3. Deploying JBoss Portal's WSRP services
14.3.1. Considerations to use WSRP when running Portal on a non-default port or hostname
14.3.2. Considerations to use WSRP with SSL
14.4. Making a portlet remotable
14.5. Consuming JBoss Portal's WSRP portlets from a remote Consumer
14.6. Consuming remote WSRP portlets in JBoss Portal
14.6.1. Overview
14.6.2. Configuring a remote producer walk-through
14.6.2.1. Using the configuration portlet
14.6.2.2. Using a WSRP Producer XML descriptor
14.6.2.3. Configuring access to a remote portlet
14.6.3. WSRP Producer descriptors
14.6.3.1. Required configuration information
14.6.3.2. Optional configuration
14.6.4. Examples
14.7. Consumers maintenance
14.7.1. Modifying a currently held registration
14.7.1.1. Registration modification for service upgrade
14.7.1.2. Registration modification on producer error
14.7.2. Consumer operations
14.7.3. Erasing local registration data
14.8. Configuring JBoss Portal's WSRP Producer
14.8.1. Overview
14.8.2. Default configuration
14.8.3. Registration configuration
14.8.3.1. Customization of Registration handling behavior
15. Security
15.1. Securing Portal Objects
15.2. Securing the Content Management System
15.2.1. CMS Security Configuration
15.2.1.1. CMS Super User
15.2.1.2. CMS Security Console
15.3. Authentication with JBoss Portal
15.3.1. Authentication configuration
15.3.2. The portal servlet
15.4. Authorization with JBoss Portal
15.4.1. The portal permission
15.4.2. The authorization provider
15.4.3. Making a programmatic security check
15.4.4. Configuring an authorization domain
16. JBoss Portal Identity Management
16.1. Identity management API
16.1.1. How to obtain identity modules services ?
16.1.2. API changes since 2.4
16.2. Identity configuration
16.2.1. Main configuration file architecture (identity-config.xml)
16.2.1.1. Datasources
16.2.1.2. Modules
16.2.1.3. Options
16.3. User profile configuration
16.4. Identity modules implementations
16.4.1. Database modules
16.4.2. Delegating UserProfile module
16.4.3. Database UserProfile module implementation
17. JBoss Portal Identity Portlets
17.1. Introduction
17.1.1. Features
17.2. Configuration
17.2.1. Captcha support
17.2.2. Lost password
17.2.3. Reset password
17.2.4. jBPM based user registration
17.2.5. The configuration file
17.2.6. Customize e-mail templates
17.3. User interface customization
17.3.1. Example 1: required fields
17.3.2. Example 2: dynamic values (dropdown menu with predefined values)
17.3.3. Example 3: adding new properties
17.3.4. Illustration
17.3.5. Customizing the View Profile page
17.4. Customizing the workflow
17.4.1. Duration of process validity
17.5. Disabling the Identity Portlets
17.5.1. Enabling the Identity Portlets
18. Authentication and Authorization
18.1. Authentication in JBoss Portal
18.1.1. Configuration
18.2. JAAS Login Modules
18.2.1. org.jboss.portal.identity.auth.IdentityLoginModule
18.2.2. org.jboss.portal.identity.auth.DBIdentityLoginModule
18.2.3. org.jboss.portal.identity.auth.SynchronizingLdapLoginModule
18.2.4. org.jboss.portal.identity.auth.SynchronizingLdapExtLoginModule
18.2.5. org.jboss.portal.identity.auth.SynchronizingLoginModule
19. LDAP
19.1. How to enable LDAP usage in JBoss Portal
19.2. Configuration of LDAP connection
19.2.1. Connection Pooling
19.2.2. SSL
19.2.3. ExternalContext
19.3. LDAP Identity Modules
19.3.1. Common settings
19.3.2. UserModule
19.3.2.1. LDAPUserModuleImpl
19.3.2.2. LDAPExtUserModuleImpl
19.3.3. RoleModule
19.3.3.1. LDAPRoleModuleImpl
19.3.3.2. LDAPExtRoleModuleImpl
19.3.4. MembershipModule
19.3.4.1. LDAPStaticGroupMembershipModuleImpl
19.3.4.2. LDAPStaticRoleMembershipModuleImpl
19.3.5. UserProfileModule
19.3.5.1. LDAPUserProfileModuleImpl
19.4. LDAP server tree shapes
19.4.1. Keeping users membership in role entries
19.4.1.1. Example LDIF
19.4.1.2. Example identity configuration
19.4.2. Keeping users membership in user entries
19.4.2.1. Example LDIF
19.4.2.2. Example identity configuration
19.5. Synchronizing LDAP configuration
19.6. Supported LDAP servers
20. Single Sign ON
20.1. Overview of SSO in portal
20.2. Using Tomcat Valve
20.2.1. Enabling Tomcat SSO Valve
20.2.2. Example of usage
20.3. CAS - Central Authentication Service
20.3.1. Integration steps
20.4. JOSSO - Java Open Single SignOn
20.4.1. Integration steps
21. CMS Portlet
21.1. Introduction
21.2. Features
21.3. CMS content
21.3.1. Configuring a window to display CMS content
21.4. CMS Configuration
21.4.1. Display CMS content
21.4.2. Service Configuration
21.4.2.1. Tuning Jackrabbit
21.4.2.2. Changing the url under which the content should be accessible
21.4.3. Configuring the Content Store Location
21.4.3.1. 100% Filesystem Storage
21.4.3.2. 100% Database Storage
21.4.3.3. Mixed Storage
21.5. Localization Support
21.6. CMS Service
21.6.1. CMS Interceptors
22. Portal Workflow
22.1. JBPM Workflow Engine Integration
22.2. CMS Publish/Approve Workflow Service
23. Navigation Tabs
23.1. Explicit ordering of tabs
23.2. Translating tab labels
23.2.1. Method one: Multiple display-name
23.2.2. Defining a resource bundle and supported locales
24. Layouts and Themes
24.1. Overview
24.2. Header
24.2.1. Overview
24.2.1.1. Writing his own JSPs
24.3. Layouts
24.3.1. How to define a Layout
24.3.2. How to use a Layout
24.3.2.1. Declarative use
24.3.2.2. Programmatic use
24.3.3. Where to place the Descriptor files
24.3.4. Layout JSP-tags
24.4. RenderSets
24.4.1. What is a RenderSet
24.4.2. How is a RenderSet defined
24.4.3. How to specify what RenderSet to use
24.5. Themes
24.5.1. What is a Theme
24.5.2. How to define a Theme
24.5.3. How to use a Theme
24.5.4. How to write your own Theme
24.6. Other Theme Functionalities and Features
24.6.1. Content Rewriting and Header Content Injection
24.6.2. Declarative CSS Style injection
24.6.3. Disabling Portlet Decoration
24.7. Theme Style Guide (based on the Industrial theme)
24.7.1. Overview
24.7.2. Main Screen Shot
24.7.3. List of CSS Selectors
24.8. Additional Ajax selectors
25. Ajax
25.1. Introduction
25.2. Ajaxified markup
25.2.1. Ajaxified layouts
25.2.2. Ajaxified renderers
25.3. Ajaxified pages
25.3.1. Drag and Drop
25.3.2. Partial refresh
25.3.2.1. Portal objects configuration
25.3.2.2. Portlet configuration
25.3.2.3. Limitations
26. Troubleshooting and FAQ
26.1. Troubleshooting and FAQ
A. *-object.xml DTD
B. portlet-instances.xml DTD
C. jboss-portlet.xml DTD

JBoss Portal - Overview

Many IT organizations look to achieve a competitive advantage for the enterprise by improving business productivity and reducing costs. Today's top enterprises are realizing this goal by deploying enterprise portals within their IT infrastructure. Enterprise portals simplify access to information by providing a single source of interaction with corporate information. Although today's packaged portal frameworks help enterprises launch portals more quickly, only JBoss Portal can deliver the benefits of a zero-cost open source license combined with a flexible and scalable underlying platform.

JBoss Portal provides an open source and standards-based environment for hosting and serving a portal's Web interface, publishing and managing its content, and customizing its experience. It is entirely standards-based and supports the JSR-168 portlet specification, which allows you to easily plug-in standards-compliant portlets to meet your specific portal needs. JBoss Portal is available through the business-friendly LGPL open source license and is supported by Red Hat Middleware, LLC Professional Support and Consulting . JBoss support services are available to assist you in designing, developing, deploying, and ultimately managing your portal environment. JBoss Portal is currently developed by Red Hat Middleware, LLC developers and community contributors.

The JBoss Portal framework and architecture includes the portal container and supports a wide range of features including standard portlets, single sign-on, clustering and internationalization. Portal themes and layouts are configurable. Fine-grained security administration down to portlet permissions rounds out the security model.

JBoss Portal Resources:

The JBoss Portal team encourages you to use this guide to install and configure JBoss Portal. If you encounter any configuration issues or simply want to take part in our community, we would love to hear from you in our forums.

Feature List

The following list details features found in this document's related release. For a technical view of our features, view the Project Roadmap and Task List .

Technology and Architecture

  • JEMS: Leverages the power of JBoss Enterprise Middleware Services : JBoss Application Server, JBoss Cache, JGroups, and Hibernate.
  • DB Agnostic: Will work with any RDBMS supported by Hibernate
  • JAAS Authentication: Custom authentication via JAAS login modules.
  • Cacheing: Utilizes render-view caching for improved performance.
  • Clusterable: Cluster support allows for portal state to be clustered for all portal instances.
  • Hot-Deployment: Leverages JBoss dynamic auto deployment features.
  • SAR Installer: Browser-based installer makes installation and initial configuration a breeze.

Single Sign On

  • Leverages Tomcat and JBoss single sign on (SSO) solutions.
  • Integrates with JOSSO and CAS out of the box. (Experimental support for Open SSO)

LDAP

  • Connect to virtually any LDAP server
  • Integrates with Sun Active Directory and OpenLDAP out of the box. (Experimental support for Active Directory)

Supported Standards

  • Portlet Specification and API 1.0 (JSR-168)
  • Content Repository for Java Technology API (JSR-170)
  • Java Server Faces 1.2 (JSR-252)
  • Java Management Extension (JMX) 1.2
  • Web Services for Remote Portlets (WSRP) 1.0 See WSRP support in Portal for more details.
  • Full J2EE 1.4 compliance when used with JBoss AS

Portal and Portal Container

  • Multiple Portal Instances: Ability to have multiple Portal instances running inside of one Portal container.
  • IPC Inter-Portlet Communication API enables portlets to create links to other objects such as a page, portal or window .
  • Dynamicity The ability for administrators and users to create and destroy objects such as portlets, pages, portals, themes, and layouts at runtime.
  • Internationalization: Ability to use internationalization resource files for every portlet.
  • Pluggable services: Authentication performed by the servlet container and JAAS make it possible to swap the authentication scheme.
  • Page-based Architecture: Allows for the grouping/division of portlets on a per-page basis.
  • Existing Framework support: Portlets utilizing Struts, Spring MVC, Sun JSF-RI, AJAX, or MyFaces are supported.

Themes and Layouts

  • Easily swappable themes/layouts: New themes and layouts containing images can be deployed in WAR archives.
  • Flexible API: Theme and Layout API are designed to separate the business layer from the presentation layer.
  • Per-page layout strategy: Different layouts can be assigned to different pages.

User and Group Functionality

  • User registration/validation: Configurable registration parameters allow for user email validation before activation.
  • Workflow: Ability to define your own jBPM workflow on user registration.
  • User login: Makes use of servlet container authentication.
  • Create/Edit Users: Ability for administrators to create/edit user profiles.
  • Create/Edit Roles: Ability for administrators create/edit roles.
  • Role Assignment: Ability for administrators to assign users to roles.
  • Captcha support: To distinct humans from machines when registering.

Permissions Management

  • Extendable permissions API: Allows custom portlets permissions based on role definition.
  • Administrative interface: Allows for permissions assignments to roles at any time for any deployed portlet, page, or portal instance.

Content Management System

  • JCR-compliant: The CMS is powered by Apache Jackrabbit, an open source implementation of the Java Content Repository API.
  • DB or Filesystem store support: Configurable content store to either a filesystem or RDBMS.
  • External Blob Support: Configurable content store allowing large blobs to reside on filesystem and content node references/properties to reside in RDBMS.
  • Versioning support: All content edited/created is autoversioned with a history of edits that can be viewed at any time.
  • Content Serving Search-engine-friendly URLS: http://yourdomain/portal/content/index.html (Does not apply to portlet actions.)
  • No long portal URLS: Serve binaries with simple urls. (http://domain/files/products.pdf)
  • Multiple HTML Portlet instance support: Allows for extra instances of static content from the CMS to be served under separate windows.
  • Directory Support: create, move, delete, copy, and upload entire directory trees.
  • File Functions: create, move, copy, upload, and delete files.
  • Embedded directory-browser: When copying, moving, deleting, or creating files, administrators can simply navigate the directory tree to find the collection they want to perform the action on.
  • Ease-of-use architecture: All actions to be performed on files and folder are one mouse-click away.
  • Full-featured HTML editor: HTML Editor contains WYSIWYG mode, preview functionality, and HTML source editting mode. HTML commands support tables, fonts, zooming, image and url linking, flash movie support, bulleted and numbered list, and dozens more.
  • Editor style-sheet support: WYSIWYG editor displays current Portal style-sheet, for easy choosing of classes.
  • Internationalization Support: Content can be attributed to a specific locale and then served to the user based on his/her browser settings.
  • Workflow Support: Basic submit for review and approval process.

Target Audience

This guide is aimed towards Portlet developers, Portal administrators, and those wishing to implement and extend the JBoss Portal framework. For end-user documentation, please refer to the JBoss Portal User Manual from the JBoss Portal Documentation Library .

Acknowledgements

We would like to thank the developers that participate in the JBoss Portal project effort.

Specifically,

  • Luca Stancapiano and Luc Boudreau for their localization contributions.
  • Antoine Herzog for his feedback, for writing Wikis and helping in the forums.
  • Mark Fernandes and Paul Tamaro from Novell, for their hard work in supplying the portal project with usable and attractive themes and layouts in the 2.4 version of JBoss Portal.
  • Martin Holzner from Novell, for his work on themes in the 2.4 version of JBoss Portal.
  • Kev "kevs3d" Roast for supplying us with two working portlets that integrate existing frameworks in to the portal: Sun JSF-RI and Spring MVC Portlet.
  • Swarn "sdhaliwal" Dhaliwal for supplying us with the Struts-Bridge, that will allow for existing struts applications to work with the Portal.
  • A few Red Hat employees, Remy Maucherat for Tomcat configuration, Magesh Kumar Bojan and Martin Putz always there to help our customers, Prabhat Jha for making sure that JBoss Portal runs great everywhere. Noel Rocher for his early feedback on JBoss Portal 2.6 and contributions. James Cobb for the Renaissance theme.
  • The JBoss Labs (http://www.JBoss.org) team for building a great infrastructure on top of JBoss Portal 2.6, providing very useful feedback and giving us the initial Drag and Drop implementation.
  • Everyone participating in the forums and Wiki in general.

Contributions of any kind are always welcome, you can contribute by providing ideas, filling bug reports, producing some code, designing a theme, writing some documentation, etc... If you think your name is missing from this page, please let us know.

Chapter 1. System Requirements

Thomas Heute

Roy Russo

The following section details tested, or reported as working by users, hardware and software versions that are compatible with JBoss Portal. Before reporting a problem, make sure you are using compatible hardware and software.

If you successfully installed JBoss Portal on versions not listed here, please let us know so it can be added to this section.

1.1. Minimum System Requirements

  • JDK 5 (JDK 6 is not part of the test platform)
  • 512 MB RAM
  • 100 MB hard disk space
  • 400 MHz CPU

1.2. Supported Operating Systems

JBoss Portal is 100% pure Java, and therefore it is interoperable with most Operating Systems capable of running a Java Virtual Machine (JVM). These Operating Systems include but are not limited to: Linux, Microsoft Windows, UNIX, and Mac OS X.

1.3. JBoss Application Server

JBoss Portal 2.6.4 is tested with JBoss Application Server (AS) 4.2.1, JBoss AS 4.2.2, JBoss Enterprise Application Platform (EAP) 4.2 and JBoss EAP 4.3. It is highly recommended that customers who have access to the JBoss Customer Support Portal (CSP) use JBoss EAP 4.3. Customers who do not have access to the JBoss CSP should use JBoss AS.

Warning

JBoss AS versions 4.0.x are not supported.

1.4. Databases

JBoss Portal is database-agnostic. The following list outlines known-to-be-working database vendor and version combinations:

Note

JBoss Portal employs Hibernate as an interface to a relational database management system (RDBMS). Most relational database management systems supported by Hibernate will work with JBoss Portal.

1.5. Source building

The source building mechanism works on Linux, Microsoft Windows, Mac OS X, and any UNIX-like Operating System.

Chapter 2. Installation

Depending on your needs, there are several different methods to install JBoss Portal. Pre-configured clustered versions (JBoss Portal Binary (Clustered)) are available from the JBoss Portal Downloads page. Clustered versions of JBoss Portal must be deployed in the JBOSS_INSTALLATION_DIRECTORY/server/all/deploy/ directory. All JBoss AS instances must reference the same datasource. See Section 2.3.2.2, “Operating System Environment Settings” for details on how to configure JBoss Portal for clustering.

An environment variable, JBOSS_HOME, is configured in Section 2.3.2.2, “Operating System Environment Settings”. References to $JBOSS_HOME assume this to be your JBOSS_INSTALLATION_DIRECTORY.

2.1. The JBoss Portal and JBoss AS Bundle

This is the easiest and fastest way to get JBoss Portal installed and running. The JBoss Portal and JBoss AS bundle contains JBoss AS, JBoss Portal, and the embedded Hypersonic SQL database. To install the JBoss Portal and JBoss AS bundle:

  1. Get the bundle: the bundle is available from the JBoss Portal Downloads page. Bundles use the JBoss Portal + JBoss AS naming convention.

  2. Extract the bundle: extract the zip archive. It does not matter which directory is used. On Microsoft Windows, the recommended directory is C:\jboss-version-number.

  3. Start the server: change into the JBOSS_PORTAL_INSTALLATION_DIRECTORY/bin/ directory. On Microsoft Windows, execute run.bat. On Linux, run the ./run.sh command. To specify a configuration to use, for example, the default configuration, append the -c default option to the run.bat or ./run.sh commands.

  4. Log in to JBoss Portal: using a Web browser, navigate to http://localhost:8080/portal to open the JBoss Portal homepage. Log in using one of the two default accounts: username user, password user, or username admin, password admin.

SQL Errors

Tables are automatically created the first time JBoss Portal starts. When deployed for the first time, JBoss Portal checks for the existence of the initial tables, which have not been created yet. This causes errors such as the following, which can safely be ignored:

WARN  [JDBCExceptionReporter] SQL Error: -22, SQLState: S0002
ERROR [JDBCExceptionReporter] Table not found in statement ...
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_repositoryentry' doesn't exist
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_version_refs' doesn't exist
				

2.2. Installing the Binary Download

The binary package typically consists of the jboss-portal.sar/ directory, documentation such as the JBoss Portal User Guide and the JBoss Portal Reference Guide, and a set of pre-configured Datasource descriptors that allow JBoss Portal to communicate with an external database. This installation method is recommended for users who already have JBoss EAP or JBoss AS installed, or those who need to install JBoss Portal in a clustered environment.

2.2.1. Setting up your Environment

2.2.1.1. Getting the Binary

The binary download is available from the JBoss Portal Downloads page. Look for the JBoss Portal Binary package. Once the binary zip file has been downloaded and extracted, the folder hierarchy will look similar to the following:

Files contained in this download will be used in later sections. Download and extract the JBoss Portal binary zip file before proceeding.

2.2.1.2. JBoss EAP and JBoss AS Setup

Before deploying JBoss Portal, make sure you have JBoss EAP or JBoss AS installed. Customers who have access to the JBoss Customer Support Portal (CSP) should download and install JBoss EAP 4.2. Customers who do not have access to the JBoss CSP are advised to use JBoss AS. For JBoss AS installation instructions, please refer to the JBoss AS Installation Guide.

Use the JBoss EAP and JBoss AS zip file

Only use the JBoss EAP and JBoss AS zip file versions. DO NOT ATTEMPT to deploy JBoss Portal on the installer version of JBoss EAP or JBoss AS.

2.2.1.3. Database Setup

A database is required for JBoss Portal to run. JBoss EAP and JBoss AS include an embedded Hypersonic SQL database that JBoss Portal can use; however, this is only recommended for developer use. The following databases are recommended for production use, and have had test suites run against them: MySQL 4, MySQL 5, Microsoft SQL Server, PostgreSQL 8, Oracle 9, and Oracle 10. JBoss Portal can use any database that is supported by Hibernate.

To configure a database to use with JBoss Portal:

  1. Create a new database: this guide assumes that the new database will be called jbossportal.

  2. Grant access rights for a user to the jbossportal database: JBoss Portal needs to create tables and modify table data. Grant access rights to a desired user to the jbossportal database. Configure the same username and password in the Datasource descriptor.

  3. Deploy a RDBMS JDBC connector: a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the $JBOSS_HOME/server/default/lib/ directory. For example, a RDBMS JDBC connector for MySQL can be download from http://www.mysql.com/products/connector/j/. For the correct RDMBS JDBC connector, please refer to the database documentation.

2.2.1.4. Datasource Configuration

The JBoss Portal binary download that was extracted in Section 2.2.1.1, “Getting the Binary”, contains pre-configured Datasource descriptors for the more popular databases. Datasource descriptors are provided for the MySQL 4, MySQL 5, PostgreSQL, Microsoft SQL Server, and Oracle databases, and can be found in the setup subdirectory where the JBoss Portal binary was extracted to:

Copy the Datasource descriptor that matches your database into the $JBOSS_HOME/server/configuration/deploy/ directory, where configuration is either all, default, minimal or production. The production configuration only exists on JBoss EAP, and not JBoss AS. For example, if you are using the all configuration, copy the Datasource descriptor into the $JBOSS_HOME/server/all/deploy/ directory.

After the Datasource descriptor has been copied into the deploy directory, make sure the username, password, connection-url, and driver-class are correct for your chosen database. Datasource descriptor files can be deployed to test before being used in production. The following is an example Datasource descriptor for the PostgreSQL database:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>PortalDS</jndi-name>
    <connection-url>jdbc:postgresql:jbossportal</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    <user-name>portal</user-name>
    <password>portalpassword</password>
  </local-tx-datasource>
</datasources>

For further details about Datasource descriptors, please refer to the JBoss JDBC Datasource wiki page.

2.2.2. Deploying JBoss Portal

To start JBoss EAP or JBoss AS and deploy JBoss Portal:

  1. Datasource descriptor: if you have not done so already, change into the setup subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (*-ds.xml) you modified in the previous steps into the $JBOSS_HOME/server/configuration/deploy/ directory.

  2. Start the server: change into the $JBOSS_HOME/bin/ directory. On Microsoft Windows, execute run.bat. On Linux, run the ./run.sh command. To specify a configuration to use, for example, the default configuration, append the -c default option to the run.bat or ./run.sh commands.

  3. Log in to JBoss Portal: using a Web browser, navigate to http://localhost:8080/portal to open the JBoss Portal homepage. Log in using one of the two default accounts: username user, password user, or username admin, password admin:

SQL Errors

Tables are automatically created the first time JBoss Portal starts. When deployed for the first time, JBoss Portal checks for the existence of the initial tables, which have not been created yet. This causes errors such as the following, which can safely be ignored:

WARN  [JDBCExceptionReporter] SQL Error: -22, SQLState: S0002
ERROR [JDBCExceptionReporter] Table not found in statement ...
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_repositoryentry' doesn't exist
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_version_refs' doesn't exist

2.3. Installing from the Sources

2.3.1. Getting the Sources

The JBoss Portal source files can be obtained from the JBoss Portal Downloads page. The source files download uses a JBoss Portal Source Code naming convention. As well, the sources can be obtained from SVN:

  • the latest source files of the 2.6 branch: http://anonsvn.jboss.org/repos/portal/branches/JBoss_Portal_Branch_2_6

  • the latest sources: http://anonsvn.jboss.org/repos/portal/trunk/

Several modules have been extracted from the JBoss Portal SVN repository. These modules have a different lifecycle and a different version scheme. The following is a list of modules used in JBoss Portal 2.6.4, and the locations of their source code:

  • JBoss Portal Common 1.1.0: http://anonsvn.jboss.org/repos/portal/modules/common/tags/JBP_COMMON_1_1_0

  • JBoss Portal Web 1.1.0: http://anonsvn.jboss.org/repos/portal/modules/web/tags/JBP_WEB_1_1_0

  • JBoss Portal Test 1.0.1: http://anonsvn.jboss.org/repos/portal/modules/test/tags/JBP_TEST_1_0_1

  • JBoss Portal Portlet 1.0.2: http://anonsvn.jboss.org/repos/portal/modules/portlet/tags/JBP_PORTLET_1_0_2

  • JBoss Portal Identity 1.0.2: http://anonsvn.jboss.org/repos/portal/modules/identity/tags/JBP_IDENTITY_1_0_2

After checking out the source from SVN, or after extracting the JBoss Portal Source Code zip file, a directory structure similar to the following will be created:

If the source files were obtained from SVN, change into the trunk/src/ directory to see the directories from the above image. As well, there will be an empty thirdparty directory. This directory will contain files after building the JBoss Portal source code (Section 2.3.3, “Building and Deploying from the Sources”). For more information about the JBoss Portal SVN repository, and accessing different versions of the JBoss Portal codebase, please visit the JBoss Portal SVN Repo page on the JBoss Wiki.

2.3.2. JBoss EAP and JBoss AS Setup

2.3.2.1. JBoss Application Server Setup

Before deploying JBoss Portal, make sure you have JBoss EAP or JBoss AS installed. Customers who have access to the JBoss Customer Support Portal (CSP) should download and install JBoss EAP 4.2. Customers who do not have access to the JBoss CSP are advised to use JBoss AS. For JBoss AS installation instructions, please refer to the JBoss AS Installation Guide.

Use the JBoss EAP and JBoss AS zip file

Only use the JBoss EAP and JBoss AS zip file versions. DO NOT ATTEMPT to deploy JBoss Portal on the installer version of JBoss EAP or JBoss AS. We are currently working on aligning the Application installer with JBoss Portal.

2.3.2.2. Operating System Environment Settings

For build targets to work, you must configure a JBOSS_HOME environment variable. This environment variable must point to the root directory of the JBoss EAP or JBoss AS installation directory, which is the directory where the JBoss EAP or JBoss AS files were extracted to.

When using Microsoft Windows, this is accomplished by going to Start > Settings > Control Panel > System > Advanced > Environment Variables. Under the System Variables section, click New. Set the JBOSS_HOME environment variable to the location of your JBoss EAP or JBoss AS installation directory:

To configure the JBOSS_HOME environment variable on Linux:

  1. Add the following line to the ~/.bashrc file. Note: this must be configured while logged in as the user who will run JBoss EAP or JBoss AS:

    export JBOSS_HOME=/path/to/jboss/installation/
    

  2. Run the following command to enable the JBOSS_HOME environment variable:

    source ~/.bashrc
    

JBoss EAP JBOSS_HOME Environment Variable

If you are running JBoss EAP, configure the JBOSS_HOME environment variable to point to the /path/to/jboss-eap-version/jboss-as/ directory.

2.3.3. Building and Deploying from the Sources

During the first build, third-party libraries will be obtained from an online repository, so you must be connected to the Internet, and if you are behind a proxy server, you need to define your proxy server address and proxy server port number. If you are running Linux, add the following line to the $JBOSS_HOME/bin/run.sh file:

JAVA_OPTS=-Dhttp.proxyHost=<proxy-hostname> -Dhttp.proxyPort=<proxy-port>

Replace proxy-hostname with the proxy server's hostname, and proxy-port with the correct proxy server port number. If you are running Microsoft Windows, add the following line to the $JBOSS_HOME/bin/run.bat file:

set JAVA_OPTS=-Dhttp.proxyHost=<proxy-hostname> -Dhttp.proxyPort=<proxy-port>

Replace proxy-hostname with the proxy server's hostname, and proxy-port with the correct proxy server port number.

To build and deploy JBoss Portal from the sources, change into the JBOSS_PORTAL_SOURCE_DIRECTORY/build/ directory, where JBOSS_PORTAL_SOURCE_DIRECTORY is the directory where the JBoss Portal source code was downloaded to. Then, Microsoft Windows users need to run the build.bat deploy command, and Linux users need to run the ./build.sh deploy command.

At the end of the build process, the jboss-portal.sar file is copied into the $JBOSS_HOME/server/default/deploy/ directory:

Portal Modules

The previous steps install a bare version of JBoss Portal. In previous versions, several additional modules were deployed as well, but this has since been modularized to provide greater flexibility. To deploy additional modules, see the Portal's module list for more information. To deploy all modules at once, change into the build directory. If you are running Linux, run the ./build.sh deploy-all command. If you are running Microsoft Windows, run the build.bat deploy-all command.

To build the clustered version on Linux Operating Systems:

  1. Change into the JBOSS_PORTAL_SOURCE_DIRECTORY/build/ directory, and run the following command:

    ./build.sh main
    

  2. Change into the JBOSS_PORTAL_SOURCE_DIRECTORY/core/ directory, and run the following command:

    ./build.sh deploy-ha
    

    After the ./build.sh deploy-ha command completes, the jboss-portal-ha.sar file is copied into the $JBOSS_HOME/server/all/deploy/ directory.

To build the clustered version on Microsoft Windows, repeat the previous steps, replacing ./build.sh with build.bat.

2.3.4. Database Setup

A database is required for JBoss Portal to run. JBoss EAP and JBoss AS include an embedded Hypersonic SQL database that JBoss Portal can use; however, this is only recommended for developer use. The following databases are recommended for production use, and have had test suites run against them: MySQL 4, MySQL 5, Microsoft SQL Server, PostgreSQL 8, Oracle 9, and Oracle 10. JBoss Portal can use any database that is supported by Hibernate.

To configure a database to use with JBoss Portal:

  1. Create a new database: this guide assumes that the new database will be called jbossportal.

  2. Grant access rights for a user to the jbossportal database: JBoss Portal needs to create tables and modify table data. Grant access rights to a desired user to the jbossportal database. Configure the same username and password in the Datasource descriptor.

  3. Deploy a RDBMS JDBC connector: a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the $JBOSS_HOME/server/default/lib/ directory. For example, a RDBMS JDBC connector for MySQL can be download from http://www.mysql.com/products/connector/j/. For the correct RDMBS JDBC connector, please refer to the database documentation.

2.3.5. Datasource Configuration

The JBoss Portal binary download that was extracted in Section 2.2.1.1, “Getting the Binary”, contains pre-configured Datasource descriptors for the more popular databases. Datasource descriptors are provided for the MySQL 4, MySQL 5, PostgreSQL, Microsoft SQL Server, and Oracle databases, and can be found in the setup subdirectory where the JBoss Portal binary was extracted to:

Copy the Datasource descriptor that matches your database into the $JBOSS_HOME/server/configuration/deploy/ directory, where configuration is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the $JBOSS_HOME/server/production/deploy/ directory. The production configuration only exists on JBoss EAP installations, and not JBoss AS.

After the Datasource descriptor has been copied into the deploy directory, make sure the username, password, connection-url, and driver-class are correct for your chosen database. Datasource descriptor files can be deployed to test before being used in production. The following is an example Datasource descriptor for the PostgreSQL database:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>PortalDS</jndi-name>
    <connection-url>jdbc:postgresql:jbossportal</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    <user-name>portal</user-name>
    <password>portalpassword</password>
  </local-tx-datasource>
</datasources>
					  

For further details about Datasource descriptors, please refer to the JBoss JDBC Datasource wiki page.

2.4. Deploying JBoss Portal

To start JBoss EAP or JBoss AS and deploy JBoss Portal:

  1. Datasource descriptor: if you have not done so already, change into the setup subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (*-ds.xml) you modified in the previous steps into the $JBOSS_HOME/server/configuration/deploy/ directory.

  2. Start the server: change into the $JBOSS_HOME/bin/ directory. On Microsoft Windows, execute run.bat. On Linux, run the ./run.sh command. To specify a configuration to use, for example, the default configuration, append the -c default option to the run.bat or ./run.sh commands.

  3. Log in to JBoss Portal: using a Web browser, navigate to http://localhost:8080/portal to open the JBoss Portal homepage. Log in using one of the two default accounts: username user, password user, or username admin, password admin:

SQL Errors

Tables are automatically created the first time JBoss Portal starts. When deployed for the first time, JBoss Portal checks for the existence of the initial tables, which have not been created yet. This causes errors such as the following, which can safely be ignored:

WARN  [JDBCExceptionReporter] SQL Error: -22, SQLState: S0002
ERROR [JDBCExceptionReporter] Table not found in statement ...
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_repositoryentry' doesn't exist
WARN  [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_version_refs' doesn't exist

Chapter 3. Customizing your Installation

Thomas Heute

This chapter describes how to customize the default installation. This includes the JBoss EAP or JBoss AS listening port, email and proxy settings, and database dialect settings. For further configuration details, please see Section 6.3, “JBoss Portal Descriptors” and Chapter 26, Troubleshooting and FAQ.

3.1. Changing the Port

It is common for web services to run on port 80. By default, JBoss EAP and JBoss AS use port 8080. If you can not use port forwarding, it is recommended to change the port JBoss EAP or JBoss AS listens on. To change the default port, open the $JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml file, and edit the Connector port value for the jboss.web service:

<Service name="jboss.web">
<Connector port="8088" address="${jboss.bind.address}"

This example changes the default port to port 8088. The JBoss EAP or JBoss AS server must be restarted before the new port settings will take affect.

The default SSL port is 8843. To enable HTTPS support, refer to the JBoss AS Guide. For further information, please see the Tomcat's SSL configuration how-to.

Please refer to Section 14.3.1, “Considerations to use WSRP when running Portal on a non-default port or hostname” to update the WSRP service after having changed the port.

Root user Privileges

Linux systems require root user privileges to run a server on a port less than 1024. Starting JBoss EAP or JBoss AS on port 80 as a non-privileged user will not work. Running JBoss EAP or JBoss AS as the root user could lead to security breaches.

3.2. Changing the Context Path

By default, the main JBoss Portal page is accessible by navigating to http://localhost:8080/portal/index.html. This can be changed to a different path, for example, http://localhost:8080/index.html. The context path can be changed when using the deployed jboss-portal.sar/, or before building from source. To change the context path when using the JBoss Portal binary package:

  1. Open the $JBOSS_HOME/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/jboss-web.xml file. If this file does not exist, copy and save the following example:

    <?xml version="1.0"?>
    <jboss-web>
       <security-domain>java:jaas/portal</security-domain>
       <context-root>/portal</context-root>
       <replication-config>
          <replication-trigger>SET</replication-trigger>
       </replication-config>
       <resource-ref>
          <res-ref-name>jdbc/PortalDS</res-ref-name>
          <jndi-name>java:PortalDS</jndi-name>
       </resource-ref>
    </jboss-web>

  2. Edit the <context-root> element with the desired context path:

    <context-root>/testing</context-root>
    

    Using this example, the main JBoss Portal page would be reached by navigating to http://localhost:8080/testing.

To change the context path when building from source:

  1. Change into the directory where the JBoss Portal Source Code zip file was extracted to, or where the source from SVN was checked out to. Copy the build/etc/local.properties-example file and save it as build/local.properties.

  2. Open the build/local.properties file and edit the portal.web.context-root option with the desired context path:

    # Context root for the portal main servlet
    portal.web.context-root=/testing
    

    Using this example, the main JBoss Portal page would be reached by navigating to http://localhost:8080/testing.

  3. To clean the project, make sure you are connected to the Internet, and change into the build/ directory. Run the ant clean command.

  4. Re-build and re-deploy JBoss Portal. See Section 2.3, “Installing from the Sources” for build instructions.

Note

By default, Tomcat holds on to the root context, /. You may need to remove the $JBOSS_HOME/server/default/deploy/jboss-web.deployer/ROOT.war/ directory, or add a jboss-web.xml file, which declares another context-root other than /, under the $JBOSS_HOME/server/default/deploy/jboss-web.deployer/ROOT.war/WEB-INF/ directory, for the above changes to take affect. The following is an example jboss-web.xml file, which changes the Tomcat context path to /tomcat-root:

<?xml version="1.0"?>
<jboss-web>
   <context-root>/tomcat-root</context-root>
</jboss-web>

3.3. Forcing the Database Dialect

This sections describes how to override the Database (DB) dialect settings. Under most circumstances, the auto-detect feature will work. If the Hibernate dialect is not working correctly, override the default behavior by following the instructions in this section.

3.3.1. Database Dialect Settings for JBoss Portal

All hibernate.cfg.xml files in all JBoss Portal modules you intend to use need to be modified. The hibernate.cfg.xml files are found in the jboss-portal.sar/module/conf/hibernate/directory/ directory, where module is the module name, and directory is a directory that, depending on the module, may or may not exist.

To modify these files to force the DB dialect, un-comment the following line from each hibernate.cfg.xml file in each JBoss Portal module you intend to use, so that it looks like the following:

<!-- Force the dialect instead of using autodetection -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>

Note: this example is for a PostgreSQL database. If you use another database, you will need to modify org.hibernate.dialect.PostgreSQLDialect to reflect the correct database. For a list of supported dialects, refer to the dialects list on the Hibernate website.

3.3.2. DB Dialect Settings for the CMS Component

To modify the DB dialect setting for the JBoss Portal CMS component:

  1. Open the jboss-portal.sar/portal-cms.sar/conf/hibernate/cms/hibernate.cfg.xml file.

  2. Un-comment the following line, so that it looks like the following:

    <!-- Force the dialect instead of using autodetection -->
    <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    

Note: this example is for a PostgreSQL database. If you use another database, you will need to modify org.hibernate.dialect.PostgreSQLDialect to reflect the correct database. For a list of supported dialects, refer to the dialects list on the Hibernate website.

3.4. Setting up the Email Service

If you have a standard setup and a mail server installed, the email service should work without any extra configuration. Most Linux distributions have a mail server installed by default. The email service, for example, can be used to verify a user's email address when a user subscribes, or for CMS workflow notifications.

The email service is configured using the $JBOSS_HOME/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml file. The following is an example of the section which is used to configure the email service:

<mbean
code="org.jboss.portal.core.impl.mail.MailModuleImpl"
name="portal:service=Module,type=Mail"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends>jboss:service=Mail</depends>
<depends>portal:service=Module,type=IdentityServiceController</depends>
<attribute name="QueueCapacity">-1</attribute>
<attribute name="Gateway">localhost</attribute>
<attribute name="SmtpUser"></attribute>
<attribute name="SmtpPassword"></attribute>
<attribute name="JavaMailDebugEnabled">false</attribute>
<attribute name="SMTPConnectionTimeout">100000</attribute>
<attribute name="SMTPTimeout">10000</attribute>
<attribute name="JNDIName">java:portal/MailModule</attribute>
</mbean>

A different SMTP server (other than localhost) can be configured, along with a SMTP username and an SMTP password. The following is an example configuration that uses the Gmail SMTP server:

<mbean
code="org.jboss.portal.core.impl.mail.MailModuleImpl"
name="portal:service=Module,type=Mail"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends>jboss:service=Mail</depends>
<depends>portal:service=Module,type=IdentityServiceController</depends>
<attribute name="QueueCapacity">-1</attribute>
<attribute name="Gateway">smtp.gmail.com</attribute>
<attribute name="SmtpUser">username@gmail.com</attribute>
<attribute name="SmtpPassword">myPassword</attribute>
<attribute name="JavaMailDebugEnabled">false</attribute>
<attribute name="SMTPConnectionTimeout">100000</attribute>
<attribute name="SMTPTimeout">10000</attribute>
<attribute name="JNDIName">java:portal/MailModule</attribute>
</mbean>

Using this example, replace username@gmail.com and myPassword with your correct Gmail username and password.

3.5. Configuring proxy settings

There are a couple of scenarios where you will need your proxy to be correctly defined at the JVM level so that you can access documents from Internet. It could be to get the thirdparty libraries if you decided to build JBoss Portal from the sources, to access RSS feeds or weather information in the samples portlet we provide or for your own needs.

To set up the proxy settings you will need to know the proxy host and the port to use then add them when starting java.

Usually setting up JAVA_OPTS environment variable to -Dhttp.proxyHost=YOUR_PROXY_HOST -Dhttp.proxyPort=YOUR_PROXY_PORT is enough.

3.6. Disabling Dynamic Proxy Un-wrapping

JBoss Portal uses the JBoss Microkernel for the service infrastructure. The JBoss Microkernel provides injection of services into other services, otherwise known as wiring. Due to the Microkernel being JMX based, it is only possible to inject dynamic proxies that talk to the MBeanServer. The overhead at runtime is minimal since the Microkernel implementation is highly optimized; however, when it is used with Java 5, a noticeable bottleneck occurs due to the fact that the implementation of the JMX API classes, javax.management.*, provided by the Java Platform, perform synchronization. This does not occur under JDK 1.4, since those classes are implemented by JBoss MX.

JBoss Portal services use a special kind of Model MBean called JBossServiceModelMBean, which allows the un-wrapping of injected dynamic proxies, and replaces them with plain old java object (POJO) services. This removes the bottleneck when using Java 5, and also provides a performance boost on JDK 1.4. By default this feature is enabled, but it is possible to disable. To do this on Linux systems, change into the $JBOSS_HOME/bin/ directory and run the following command:

./run.sh -Dportal.kernel.no_proxies=false

On Microsoft Windows systems, run the following command:

run.bat -Dportal.kernel.no_proxies=false

Chapter 4. Upgrading JBoss Portal 2.4 to 2.6

Warning

Before performing any instructions or operations in this chapter, back up your database content and the entire JBoss EAP or JBoss AS directory!

4.1. Manual Upgrade

Although the database schema remains the same in JBoss Portal 2.6, there are several differences that prevent simply deploying the latest version of JBoss Portal, when using a database created for JBoss Portal 2.4. This chapter describes updating a JBoss Portal 2.4 MySQL database for use with JBoss Portal 2.6.

The upgrade procedure can be straightforward:

  1. If you are using the JBoss Portal binary, remove the $JBOSS_HOME/server/default/deploy/jboss-portal.sar/ directory. If JBoss Portal was built from source, remove the $JBOSS_HOME/server/default/deploy/jboss-portal.sar file.

  2. Update the data in the JBoss Portal database, as described in Section 4.1.2, “Updating the Database”.

  3. Deploy JBoss Portal 2.6.

4.1.1. Themes

Themes in JBoss Portal 2.6 have changed since the Portal pages now contain additional areas, such as the Login, Admin, and Dashboard links, on the top right-hand corner:

If you use a default theme that exists in JBoss Portal 2.6, such as renaissance, no configuration should be necessary. Using old themes from JBoss Portal 2.4 may make JBoss Portal 2.6 unusable, for example, not being able to log in. To update custom themes, please refer to those bundled with JBoss Portal as an example.

4.1.2. Updating the Database

All procedures described in the following sections can performed using the AdminPortlet. Treat the directions as guidelines if you need to automate the migration of a large JBoss Portal deployment.

Database schema has not changed between the JBoss Portal 2.4 and 2.6 releases, but certain content that is kept in the databases has changed. Data can be updated manually by using the correct tools for your RDBMS. For example, if you are using a MySQL database, you can use the MySQL Query Browser.

The following instructions refer to a standard JBoss Portal 2.4 deployment. If you named core portlets, portlet instances, or portlet windows differently, you will need to make the appropriate modifications. The following is an example of using the MySQL Query Browser:

4.1.3. Portlet Names

Names of certain core bundled portlets have changed. Destroy the following instances and use the AdminPortlet to recreate them, or, edit the JBP_INSTANCES table as follows:

  1. Change local.portal.CMSPorlet in the PORTLET_REF column to local./portal-cms.CMSPortlet.

  2. Change local.portal.CMSAdminPorlet in the PORTLET_REF column to local./portal-cms.CMSAdminPortlet.

  3. Change local.portal.ManagementPorlet in the PORTLET_REF column to local./portal-admin.AdminPortlet.

The NavigationPortlet from JBoss Portal 2.4 has been removed, and its functionality is now replaced by PageCustomizerInterceptor. All references to the NavigationPortlet should be removed from all portal pages. Remove NavigationPortletInstance using the AdminPortlet, or edit the database as follows:

  1. In the JBP_INSTANCES table, rows containing local.portal.NavigationPortlet in the PORTLET_REF column.

  2. In the JBP_WINDOW table, rows containing NavigationPortletInstance in the INSTANCE_REF column.

  3. In the JBP_OBJECT table, rows containing NavigationPortletWindow in the NAME column.

4.1.4. CMS

In JBoss Portal 2.6 versions, the way the CMS content is displayed changed significantly. For further information, please refer to Chapter 9, Content Integration and Chapter 21, CMS Portlet. Currently there is no need to have more than one instance of the CMSPortlet. The portlet window displays CMS content, not by referring to that portlet instance, but by having the proper content-type defined. The following configuration is in the jboss-portal.sar/conf/data/default-object.xml file:

<window>
   <window-name>CMSWindow</window-name>
   <content>
      <content-type>cms</content-type>
      <content-uri>/default/index.html</content-uri>
   </content>
   <region>center</region>
   <height>0</height>
</window>

The following example uses the MySQL Query Browser. Open the JBP_OBJECT_NODE table in your database schema. Look at the PATH column to identify any occurrences of CMS in your JBoss Portal deployment. Identify any row referring to CMSPortletWindow, and remember the number in PK column. The PK number is needed in the following steps:

Go to the JBP_WINDOW table and find a row with the same PK value from the JBP_OBJECT_NODE table. In such a row, replace CMSPortletInstance with a path to your CMS resource. For example, by default, JBoss Portal displays /default/index.html.

Go to the JBP_PORTAL_OBJECT_PROPS table and add a row containing:

  • The PK number remembered from the OBJECT_KEY column.

  • portal.windowContentType in the NAME column.

  • cms in the jbp_VALUE column.

Portlet Content Type and Path to the CMS Resource

You can change the portlet window content type and configure the path to the CMS resource using the AdminPortlet.

Chapter 5. Portlet Primer

Roy Russo

5.1. JSR-168 Overview

The JSR-168 Portlet Specification aims at defining portlets that can be used by any JSR-168 portlet container, also known as a portal. There are different portals with commercial and non-commercial licenses. This chapter gives a brief overview of the JSR-168 Portlet Specification. Portlet developers are strongly encouraged to read the JSR-168 Portlet Specification.

JBoss Portal is fully JSR-168 compliant, which means any JSR-168 portlet will behave as it should inside the portal.

5.1.1. Portal Pages

A portal can be seen as pages with different areas, and inside areas, different windows, and each window having one portlet:

5.1.2. Rendering Modes

A portlet can have different view modes. Three modes are defined by the JSR-168 specification, but a portal can extend those modes. The three modes are:

  • VIEW - generates markup reflecting the current state of the portlet.

  • EDIT - allows a user to customize the behavior of the portlet.

  • HELP - provides information to the user as to how to use the portlet.

5.1.3. Window States

Window states are an indicator of how much page real-estate a portlet should consume on any given page. The three states defined by the JSR-168 specification are:

  • NORMAL - a portlet shares this page with other portlets.

  • MINIMIZED -a portlet may show very little information, or none at all.

  • MAXIMIZED - a portlet may be the only portlet displayed on this page.

5.1.4. Section Status

This overview of the JSR-168 Portlet Specification is a work in progress. Check back for more in-depth analsis of the specification. The sections following here after contain real-world cases for how to leverage the specification.

5.2. Tutorials

The tutorials contained in this chapter are targetted toward portlet developers. Although they are a good starting and reference point, it is highly recommend that portlet developers read and understand the JSR-168 Portlet Specification. Use the JBoss Portal User Forums for user-to-user help.

5.2.1. Deploying your First Portlet

5.2.1.1. Introduction

This section details deploying your first portlet in JBoss Portal. Before proceeding, download the HelloWorldPorlet from JBoss PortletSwap.

5.2.1.2. Package Structure

Like other Java EE applications, portlets are packaged in WAR files. A typical portlet WAR file can include servlets, resource bundles, images, HTML, JSPs, and other static or dynamic files. The following is an example of the directory structure of the HelloWorldPortlet portlet:

5.2.1.3. Portlet Classes

The following is the HelloWorldPortlet/src/main/org/jboss/portlet/hello/HelloWorldPortlet.java java source file, which comes bundled with the HelloWorldPortlet:


package org.jboss.portlet.hello;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;
import java.io.IOException;
import java.io.PrintWriter;

public class HelloWorldPortlet extends GenericPortlet

{
	protected void doView(RenderRequest rRequest, RenderResponse rResponse) 
	throws PortletException, IOException, UnavailableException

	{
		rResponse.setContentType("text/html");
		PrintWriter writer = rResponse.getWriter();
		writer.write("Hello World!");
		writer.close();
	}

} 

public class HelloWorldPortlet extends GenericPortlet

All portlets must implement the javax.portlet.Portlet interface. The portlet API provides a convenient implementation of this interface, in the form of the javax.portlet.GenericPortlet class, which among other things, implements the Portlet render method to dispatch to abstract mode-specific methods to make it easier to support the standard portlet modes. As well, it provides a default implementation for the processAction, init and destroy methods. It is recommended to extend GenericPortlet for most cases.

protected void doView(RenderRequest rRequest, RenderResponse rResponse) 
throws PortletException, IOException, UnavailableException

As we extend from GenericPortlet, and are only interested in supporting the VIEW mode, only the doView method needs to be implemented, and the GenericPortlet render implemention calls our implementation when the VIEW mode is requested.

rResponse.setContentType("text/html");

As in the servlet-world, you must declare what content-type the portlet will be responding in. Do this before starting to write content, or the portlet will throw an exception.

PrintWriter writer = rResponse.getWriter(); 
writer.write("Hello World!"); 
writer.close();

This produces the Hello World! text in our portlet window.

Note

Portlets are responsible for generating markup fragments, as they are included on a page and are surrounded by other portlets. In particular, this means that a portlet outputting HTML must not output any markup that cannot be found in a <body> element.

5.2.1.4. Application Descriptors

JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. The following is an example of the directory structure of the HelloWorldPortlet portlet: