Chapter 3. Customizing your installation

Thomas Heute

This section is intended to describe some customization features available in JBoss Portal. If it is not covered here, please view the FAQ chapter at the end of this document or the descriptor chapter ( Section 6.2, “JBoss Portal Descriptors” ) for further documentation on configuration and tuning JBoss Portal.

3.1. Changing the port

It is common to have a server running on the port 80 instead of the default port 8080.

It might be easier to use port forwarding than to change the port manually. Since port forwarding is not always possible, below are the instructions to change the port number manually.

To change it, you need to edit the file $JBOSS_HOME/server/default/deploy/jbossweb-tomcat50.sar/server.xml and change the port value of the HTTP Connector. You can also change the value of the SSL port, by default it is set to 8443. Remember to uncomment the following when you have configured it:

            
      <!-- SSL/TLS Connector configuration using the admin devl guide keystore
      <Connector port="8443" address="${jboss.bind.address}"
           maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
           emptySessionPath="true"
           scheme="https" secure="true" clientAuth="false"
           keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
           keystorePass="rmi+ssl" sslProtocol = "TLS" />
      -->
            
         

You also need to change the port number in the following files for WSRP:

  • jboss-portal.sar/portal-wsrp.sar/default-wsrp.xml
  • jboss-portal.sar/portal-wsrp-client.jar/META-INF/jboss-client.xml (for the producer with the self id.
  • jbossws.sar/META-INF/jboss-service.xml as indicated in JBoss WS' URL rewriting FAQ
  • http-invoker.sar/META-INF/jboss-service.xml

Now you can restart JBoss and use the new port that you defined. On systems like Linux, you need privileges to be able to run a server on a port lower than 1000, starting JBoss on the port 80 as a regular user will not work, for testing you can log as root but is not recommended if the server is public as it could be a security breach in your system.

3.2. Changing the context path

By default, the "main" page of JBoss portal will be accessible at http://localhost:8080/portal/index.html . You may want to change that either to a different name or to http://localhost:8080/index.html .

Note

By default, Tomcat holds on to the root context '/'. Some users have mentioned that you also need to remove the $JBOSS_HOME\server\default\deploy\jbossweb-tomcat55.sar\ROOT.war for the below changes to take effect on restart.

You can accomplish this, with either a deployed jboss-portal.sar or before you build from source:

  • Binary method:

    1. Open JBOSS_INSTALL_DIRECTORY/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/jboss-web.xml

      <?xml version="1.0"?>
      <jboss-web>
         <security-domain>java:jaas/portal</security-domain>
         <context-root>/portal</context-root>
         <replication-config>
            <replication-trigger>SET_AND_GET</replication-trigger>
            <replication-type>SYNC</replication-type>
         </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 to whatever you desire.

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

  • Source method: Edit the file $PORTAL_HOME/build/local.properties (You can copy the file $PORTAL_HOME/build/etc/local.properties-example and modify it for your own settings.) and change portal.web.context-root to anything you want.

    Now clean the project (ant clean) then build JBoss portal (ant) and redeploy it for the context path changes to take effect. For build instructions, please see: Section 2.3, “Installing from Sources”

3.3. Forcing the DB dialect

If you encounter that the Hibernate dialect is not working properly and would like to override the default behaviour, follow the instructions contained in this section:

Note

Under most common circumstances, the auto-detect feature should work fine.

3.3.1. DB Dialect settings for the portal core

Modify jboss-portal.sar/conf/hibernate/[module]/hibernate.cfg.xml . A list of supported dialects for Hibernate3, can be found here .

               <?xml version='1.0' encoding='utf-8'?>
               <!DOCTYPE hibernate-configuration PUBLIC
               "-//Hibernate/Hibernate Configuration DTD//EN"
               "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
               <hibernate-configuration>
               <session-factory>
               <property name="connection.datasource">java:PortalDS</property>
               <property name="show_sql">false</property>
               <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
               <property name="cache.use_query_cache">true</property>
               
               <!-- Force the dialect instead of using autodetection -->
               <!--
               <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
               -->
               
               <!-- Mapping files -->
               <mapping resource="conf/hibernate/user/domain.hbm.xml"/>
               </session-factory>
               </hibernate-configuration>               
               

3.3.2. DB Dialect settings for the CMS component

Modify jboss-portal.sar/portal-cms.sar/conf/hibernate/cms/hibernate.cfg.xml . A list of supported dialects for Hibernate3, can be found here .

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
      <property name="connection.datasource">java:@portal.datasource.name@</property>
      <property name="show_sql">@portal.sql.show@</property>
      <property name="cache.use_second_level_cache">false</property>
      <property name="cache.use_query_cache">true</property>

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

      <!-- Mapping files -->
      <mapping resource="conf/hibernate/cms/domain.hbm.xml"/>
   </session-factory>
</hibernate-configuration>