JBoss

This section describes how to setup the Stardust Portal and the Process Engine in JBoss. Many figures are from the Windows operating system but any supported JBoss platform can be used. Note that currently, for JBoss version 7.1, only Spring deployment is supported. Also note that for JBoss EAP 6.2 the JBoss version 7.1 Spring deployment is compatible and should be used, if required.

Prerequisites

The following sections discuss prerequisites that must be performed before Stardust can be deployed within a JBoss application server.

A basic understanding of JBoss Administration, Enterprise Application Archive (EAR), and Web Application Archive (WAR) files is required from this point forward.

Note
We we recommend to enable 2nd-level caching for production deployments to optimize the performance of a secure JCR deployment. For details refer to section Tuning by using Hazelcast and to chapter Optimizing the Performance of secure JCR Deployments accordingly.

JBoss Download and Installation

Please refer to the Stardust Release Notes for details on the currently supported JBoss version. Make sure your JAVA_HOME variable is set correctly in case you start the JBoss server from the command line.

To prepare the JBoss deployment:

  1. Download JBoss.
  2. Extract the ZIP-File.
  3. Copy %JBOSS_HOME%/server/default to %JBOSS_HOME%/server/<serverName>
  4. The server can be started with
    %JBOSS_HOME%/bin/run.bat -c <serverName>

If a server name is used other than default, edit the JBoss startup script in %JBOSS_HOME%/bin and add the following JVM system property to the command line.

-Djboss.server.name=<serverName>

Additional JBoss system properties can be set in the startup script. Please refer to the JBoss documentation for more information regarding system properties.

JDBC Drivers

Copy JDBC drivers used to access the Stardust Audit Trail Database to the following directory, %JBOSS_HOME%/server/ <serverName>/lib.

Predefined Deployment Configurations for JBoss

Stardust provides preconfigured deployment configuration for JBoss as Maven archetype templates. You can download them from the Stardust artifactory matching your requirements. The following deployment configurations for JBoss are provided to prepare a Stardust Portal WAR/EAR deployment for JBoss 5.1:

Refer to chapter Creating a Stardust Runtime Environment with Apache Maven in the Stardust Installation Guide for details.

Stardust provides predefined deployment configurations:

Please refer to the Stardust support team for details on how to receive these configurations.

Deployment Configuration with JBoss Version 5.1

This section covers steps required to configure a deployment with JBoss Version 5.1.

XA Data Source

The connection to the Stardust Audit Trail database is configured in a xml file and placed in the folder %JBOSS_HOME%/server/<serverName>/deploy. You can copy a JBoss supplied example XA datasource file located at %JBOSS_HOME%/docs/examples/jca/<database>-xa-ds.xml to %JBOSS_HOME%/server/<server-name>/deploy/ipp-xa-ds.xml and modify it with content to match the Stardust Audit Trail database, such as:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE datasources
    PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">

<datasources>
     <xa-datasource>
         <jndi-name>AuditTrail.DataSource</jndi-name>
         <xa-datasource-property name="URL">database_url</xa-datasource-property>
         <xa-datasource-class> database_driver_fully_qualified_class_namee</xa-datasource-class>
         <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
         <user-name>database_username</user-name>
         <password>database_password</password>
         <track-connection-by-tx>true</track-connection-by-tx>
         <no-tx-separate-pools>true</no-tx-separate-pools>
         <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.<databasetype>ExceptionSorter</exception-sorter-class-name>
         <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.<databasetype>ValidConnectionChecker</valid-connection-checker-class-name>
         <min-pool-size>1</min-pool-size>
         <max-pool-size>10</max-pool-size>
         <idle-timeout-minutes>10</idle-timeout-minutes>
         <no-tx-separate-pools/>
         <metadata>
             <type-mapping><databasetype></type-mapping>
         </metadata>
     </xa-datasource>
 </datasources>

XA Connection Factory and JMS queues

For an Spring setup, JMS is an optional, but highly recommended component. For EAR setups JMS is required.

The connection factory and the JMS queues are configured with the following content in %JBOSS_HOME%/server/ <server-name>/deploy/ipp-jms-ds.xml. Create this file, and paste the following contents into the file.

<?xml version="1.0" encoding="UTF-8"?>

<server>
   
   <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=CarnotApplicationQueue" xmbean-dd="xmdesc/Queue-xmbean.xml">
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
   <depends>jboss.messaging:service=PostOffice</depends>
   <attribute name="JNDIName">queue/CarnotApplicationQueue</attribute>
   <attribute name="RedeliveryDelay">10000</attribute>
   <attribute name="MaxDeliveryAttempts">3</attribute>
   </mbean>
   <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=CarnotSystemQueue" xmbean-dd="xmdesc/Queue-xmbean.xml">
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
   <depends>jboss.messaging:service=PostOffice</depends>
   <attribute name="JNDIName">queue/CarnotSystemQueue</attribute>
   <attribute name="RedeliveryDelay">10000</attribute>
   <attribute name="MaxDeliveryAttempts">3</attribute>
   </mbean>
   <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=CarnotDaemonQueue" xmbean-dd="xmdesc/Queue-xmbean.xml">
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
   <depends>jboss.messaging:service=PostOffice</depends>
   <attribute name="JNDIName">queue/CarnotDaemonQueue</attribute>
   <attribute name="RedeliveryDelay">10000</attribute>
   <attribute name="MaxDeliveryAttempts">3</attribute>
   </mbean>
   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
      name="jboss.messaging.connectionfactory:service=CarnotConnectionFactory"
      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
      <depends>jboss.messaging:service=PostOffice</depends>
      
      <attribute name="JNDIBindings">
         <bindings>
            <binding>/CarnotConnectionFactory</binding>
            <binding>java:/CarnotConnectionFactory</binding>
         </bindings>
      </attribute>
   </mbean>
</server>

XA JCR Data Source

To prepare a standalone Jackrabbit deployment on JBoss, perform the following steps:

  1. Copy the jcr-2.0.jar file from the lib folder of your Stardust installation to your deploy folder (e.g. <JBoss_dir>/server/<serverName>/lib). If the portal's war files already contain a copy of jcr-2.0.jar, delete it from the war files to avoid classloader problems.
  2. Download the Jackrabbit rar file from http://archive.apache.org/dist/jackrabbit/2.6.1/jackrabbit-jca-2.6.1.rar.
  3. Copy the file to your deploy folder (e.g. <JBoss_dir>/server/<serverName>/deploy).
  4. Remove the following logging dependencies from the jackrabbit-jca-2.6.1.rar to avoid conflicts with JBoss embedded logging dependencies:
  5. Create the file ipp-jcr-ds.xml in your deploy folder. Change the entries as follows:
    1. Change the homeDir property to match the folder where you want Jackrabbit to store its files.
    2. Change the configFile property to match the file with the Jackrabbit repository configuration (repository.xml).
    <?xml version="1.0" encoding="UTF-8"?>
    <connection-factories>
        <tx-connection-factory>
            <jndi-name>JcrContentRepository</jndi-name>
            <xa-transaction/>
            <rar-name>jackrabbit-jca-2.6.1.rar</rar-name>
            <connection-definition>javax.jcr.Repository</connection-definition>
            <config-property name="homeDir" type="java.lang.String">C:/repository-jcr</config-property>
            <config-property name="configFile" type="java.lang.String">classpath:repository.xml</config-property>
            <config-property name="bindSessionToTransaction" type="java.lang.Boolean">true</config-property>
        </tx-connection-factory>
    </connection-factories>
  6. Create a configuration in your repository.xml as definied in your ipp-jcr-ds.xml in JBOSS_HOME/server/<serverName>/conf folder, Start with the default configuration and adopt to your environment and requirements)
  7. Create the following property files and add them to your classpath:
  8. In the users.properties file, add default entries, which can be one or more users as keys and their passwords as values:
    ipp-jcr-user=ipp-jcr-password
  9. To change the user/password, in your carnot.properties file, you can add two entries - ContentRepository.User=<username> and ContentRepository.Password=<password>, which should be the same as the entries in users.properties.
  10. You can leave the roles.properties file empty.

Remove build-in JSF implementation

  1. Remove the JSF jars %JBOSS_HOME%/server/<serverName>/deploy/jbossweb.sar/jsf-libs/*.jar.
  2. Remove the following line from %JBOSS_HOME%/server/<serverName>/deploy/jbossweb.sar/META_INF/jboss-structure.xml:
    <path name="jsf-libs" suffixes=".jar" />
  3. Edit %JBOSS_HOME%/server/<serverName>/deployers/jbossweb.deployer/web.xml by commenting out or removing the following lines:

Without the JSF-libraries, also the admin-console doesn't work anymore. This Web application is a default deployment and might be removed.

Deployment with JBoss Version 7.1 or JBoss EAP version 6.2

The setup for JBoss EAP 6.2 EJB or Spring deployment is identical just that some JBoss subsystems declarations that are already defined in the standalone.xml might have a newer version. To prepare a Spring deployment on JBoss 7.1, perform the following steps:

  1. Start JBoss via
    <JBoss-Home>/bin/standalone.bat
  2. Add user for administration console (http://localhost:9990/console):
    <JBoss-Home>/bin/add-user.bat
  3. Add deployments in the administration console

DataSource (MySQL)

JBoss 7 uses a module system for class loading. Therefore a new module for the database driver jar has to be created. The module has to be created in folder <JBoss-Home>/modules:

  1. Create a new folder com/mysql/main in folder <JBoss-Home>/modules
  2. Create a new file module.xml with following content in that folder:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.0" name="com.mysql">
       <resources>
          <resource-root path="mysql-connector-java-5.1.21-bin.jar" />
       </resources>
       <dependencies>
          <module name="javax.api" />
          <module name="javax.transaction.api"/>
       </dependencies>
    </module>
  3. Copy the mysql database driver mysql-connector-java-5.1.21-bin.jar into folder <JBoss-Home>/modules/com/mysql/main.
  4. Add a driver reference in server configuration file <JBoss-Home>/standalone/configuration/standalone.xml in 'drivers' element:
    <driver name="mysql" module="com.mysql">
       <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
    </driver>
  5. Add a datasource in server configuration file <JBoss-Home>/standalone/configuration/standalone.xml in 'datasources' element:
    <xa-datasource jndi-name="java:/AuditTrail.DataSource" pool-name="AuditTrailDS" enabled="true" use-java-context="true" use-ccm="false">
       <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/ipp</xa-datasource-property>
       <driver>mysql</driver>
       <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
       <xa-pool>
           <no-tx-separate-pools>true</no-tx-separate-pools>
           <min-pool-size>1</min-pool-size>
           <max-pool-size>10</max-pool-size>
       </xa-pool>
       <timeout>
           <idle-timeout-minutes>10</idle-timeout-minutes>
       </timeout>
       <security>
           <user-name>carnot</user-name>
           <password>ag</password>
       </security>
       <validation>
           <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
           <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
       </validation>
    </xa-datasource>

Web Service Endpoint Issue

An issue with already registered Web Service endpoints might occur because JBoss already starts a Web service. To prevent the issue, comment out the following lines in file <JBoss-Home>/standalone/configuration/standalone.xml:

<!--  subsystem xmlns="urn:jboss:domain:webservices:1.1">
   <modify-wsdl-address>true</modify-wsdl-address>
   <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
   <endpoint-config name="Standard-Endpoint-Config"/>
   <endpoint-config name="Recording-Endpoint-Config">
       <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
           <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
       </pre-handler-chain>
   </endpoint-config>
</subsystem> -->

Jackrabbit Configuration

  1. Create a new folder javax/jcr/main in folder <JBoss-Home>/modules
  2. Create a new file module.xml with following content in that folder:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module xmlns="urn:jboss:module:1.0" name="javax.jcr">
    	<resources>
            <resource-root path="jcr-2.0.jar"/>
        </resources>
    	<dependencies>
    		<module name="javax.transaction.api" export="true"/>
    	</dependencies>
    </module>
  3. Copy jcr-2.0.jar to folder <JBoss-Home>/modules/javax/jcr/main.
  4. Copy the jackrabbit-jca-2.6.1.rar to <JBoss-Home>/standalone/deployments folder. In the rar file the META-INF/MANIFEST.MF has to be changed by adding the following line to the end of the file:
    Dependencies: javax.jcr export,org.slf4j
    Further the jars logback-classic-0.9.20.jar and logback-core-0.9.20.jar have to be removed from rar file to use the JBoss logging framework.
  5. In <JBoss-Home>/standalone/configuration/standalone.xml the following content should be added inside <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"> in the <resource-adapters> element:
    <resource-adapter>
       <archive>
           jackrabbit-jca-2.6.1.rar
       </archive>
       <transaction-support>
           XATransaction
       </transaction-support>
       <connection-definitions>
           <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:/jcr/jackrabbit" enabled="true" use-java-context="true" use-ccm="false">
               <config-property name="configFile">
                    C:/tmp/configuration/repository.xml
               </config-property>
               <config-property name="bindSessionToTransaction">
                   true
               </config-property>
               <config-property name="homeDir">
                   C:/tmp/jcrjboss7
               </config-property>
           </connection-definition>
       </connection-definitions>
    </resource-adapter>
  6. Copy the repository.xml configuration file to <JBoss-Home>/standalone/configuration folder.
  7. Due to an issue with validation when deploying Jackrabbit on JBoss ( see https://issues.apache.org/jira/browse/JCR-3241), the archive-validation should be disabled within the JCA subsystem in <JBoss-Home>/standalone/configuration/standalone.xml as a workaround:
       <subsystem xmlns="urn:jboss:domain:jca:1.1">
       <archive-validation enabled="false" fail-on-error="true" fail-on-warn="false"/>
  8. Set up a global module for jcr-2.0.jar to be accessible to all deployments. In <subsystem xmlns="urn:jboss:domain:ee:1.0"> add the following lines:
    <global-modules>
       <module name="javax.jcr" slot="main" />            
    </global-modules>

JMS Configuration

In <JBoss-Home>/standalone/configuration/standalone.xml the following content should be added inside <subsystem xmlns="urn:jboss:domain:messaging:1.1">. The following issue is fixed on Jboss EAP 6.2 but if JBoss 7.1 is used the connection-factory dummyCF has to be created as workaround due to the following JBoss issue https://issues.jboss.org/browse/AS7-5538:

<hornetq-server>
   <connectors>
       <in-vm-connector name="in-vm" server-id="0"/>
   </connectors>
   <acceptors>
       <in-vm-acceptor name="in-vm" server-id="0"/>
   </acceptors>
   <jms-connection-factories>
   <--JBoss 7.1 Only -->
       <connection-factory name="dummyCF">
           <connectors>
               <connector-ref connector-name="in-vm"/>
           </connectors>
           <entries>
               <entry name="java:jboss/exported/jms/dummyCF"/>
           </entries>
       </connection-factory>
       <pooled-connection-factory name="hornetq-ra">
           <connectors>
              <connector-ref connector-name="in-vm"/>
           </connectors>
           <entries>
              <entry name="java:/CarnotConnectionFactory"/>
           </entries>
           <transaction mode="xa"/>
       </pooled-connection-factory>
   </jms-connection-factories>
   <jms-destinations>
       <jms-queue name="IppApplicationQueue">
           <entry name="java:/queue/CarnotApplicationQueue"/>
       </jms-queue>
       <jms-queue name="IppSystemQueue">
           <entry name="java:/queue/CarnotSystemQueue"/>
       </jms-queue>
       <jms-queue name="IppDaemonQueue">
           <entry name="java:/queue/CarnotDaemonQueue"/>
       </jms-queue>
   </jms-destinations>
</hornetq-server>

Setting up additional Jackrabbit VFS Repositories

To set up additional Jackrabbit VFS repositories in JBoss, you need to configure a new connection factory on the server using a different repository home and JNDI name.

This resource can then be bound using the DocumentManagementService#bindRepository API. Please refer to chapter Managing Document Repositories of the Programming Guide for details.

Tuning by using Hazelcast

You can use Hazelcast for tuning via retrieving entities from in-memory cache. Hazelcast is a clustering and scalable data distribution platform. For detailed information on Hazelcast refer to http://www.hazelcast.com/product.jsp.

For details on tuning via an in-memory cache in Stardust refer to chapter Retrieving Entities from In-Memory Cache in the Developer Handbook.

Example Use Case

The following examples demonstrates the usage of Hazelcast on WebLogic 10.3. Stardust provides a prepared RAR file to be deployed with WebLogic.

Separate RAR deployment

To perform a separate RAR deployment, copy the artifact

  1. Copy the artifact com.hazelcast:hazelcast:2.4:rar to the %JBOSS_HOME%/server/default/lib folder ( https://infinity.sungard.com/repository/ipp-3rd-party/com/hazelcast/hazelcast-ra/2.4-stardust01/hazelcast-ra-2.4-stardust01.rar ) of your JBoss application server.
  2. Deploy the resource adapter com.hazelcast:hazelcast-ra:2.4:rar with the following adjustments:
    1. The file ra.xml in META-INF/ folder of the RAR file as well as the hazelcast-ra-2.4.jar file need to be adjusted such that the line
      <icon></icon>
      is removed
    2. A file ending with -ds.xml, residing in %JBOSS_HOME%/server/default/deploy, and having the following content can be used as a data source in order to make the Hazelcast connection factory available under java:/HazelcastCF in the JNDI tree:
       <?xml version="1.0" encoding="UTF-8"?>
         <!DOCTYPE connection-factories
            PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
               "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
      
         <connection-factories> 
            <tx-connection-factory>
               <local-transaction/>
               <track-connection-by-tx>true</track-connection-by-tx>
               <jndi-name>HazelcastCF</jndi-name>
               <rar-name>hazelcast-ra-2.4.rar</rar-name>
               <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition> 
            </tx-connection-factory>
         </connection-factories>
         
  3. Optionally put an appropriate hazelcast.xml on the classpath of your EAR. Otherwise a default configuration will be taken from hazelcast-ra-2.4.jar.

RAR inside EAR deployment

To perform a RAR inside EAR deployment perform the following steps:

  1. Copy hazelcast-ra-2.4-stardust01.rar (download from https://infinity.sungard.com/repository/ipp-3rd-party/com/hazelcast/hazelcast-ra/2.4-stardust01/hazelcast-ra-2.4-stardust01.rar) to /standalone/deployments
  2. Add hazelcast.xml to your classpath
  3. Add the following lines to the standalone.xml file:
    <resource-adapters>
       <resource-adapter>
           <archive>hazelcast-ra-2.4-stardust01.rar</archive>
           <transaction-support>XATransaction</transaction-support>
           <connection-definitions>
               <connection-definition class-name="com.hazelcast.jca.ManagedConnectionFactoryImpl" jndi-name="java:/HazelcastCF" use-ccm="false" />
          </connection-definitions>
       </resource-adapter>
          
  4. Add the following to your jboss-web.xml file:
    <resource-ref>
       <res-ref-name>cache/HazelcastCF</res-ref-name>
       <jndi-name>java:/HazelcastCF</jndi-name>
    </resource-ref>
  5. Extend your web.xml file with the following lines:
    <resource-ref>
       <res-ref-name>cache/HazelcastCF</res-ref-name>
       <res-type>com.hazelcast.jca.HazelcastConnectionFactoryImpl</res-type>
       <res-auth>Container</res-auth>
    </resource-ref>
  6. Create modules for hazelcast-2.4-stardust01.jar and hazelcast-ra-2.4-stardust01.jar and add them to global modules in standalone.xml:
  7. Add Hazelcast modules to global modules in standalone.xml:
    <subsystem xmlns="urn:jboss:domain:ee:1.0">
       <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
       <global-modules>
           <module name="javax.jcr" slot="main"/>
           <module name="com.hazelcast" slot="main"/>
           <module name="com.hazelcast.ra" slot="main"/>
       </global-modules>
    </subsystem>
  8. Set the following properties in your carnot.properties file:
    Infinity.Engine.Caching = true
    Infinity.Engine.Caching.CacheFactory = org.eclipse.stardust.engine.core.cache.hazelcast.HazelcastCacheFactory
    
    Infinity.Engine.Caching.Hazelcast.TxMode = rw
    Infinity.Engine.Caching.Hazelcast.ConnectionFactoryJndiName = HazelcastCF
    Infinity.Engine.Caching.Hazelcast.GlobalCacheName = ipp-2nd-level-cache
       
  9. In ra.xml config-properties have to be initialized as JBoss does not accept empty string values. For config-property connectionTracingEvents a value e.g. FACTORY_INIT has to be set:
    <config-property>
       <description>Comma separated list of FACTORY_INIT, CREATE, TX_START, TX_COMPLETE, CLEANUP and DESTROY to
          trace connection events</description>
       <config-property-name>connectionTracingEvents</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>FACTORY_INIT</config-property-value>
    </config-property>