The OpenShift PaaS environment has updated the JBossAS cartridge to use jboss-as-7.1.0.Final as the server version.  This post updates how to test the OpenShift JBossAS7 7.1.0.Final based cartridge standalone configuration in your own environment.


The configuration of the JBossAS7 server used by the OpenShift Express JBossAS cartridge is a simple modification of the jboss-as-7.1.0.Final release which my be obtained from http://www.jboss.org/as7.html


The contents of the jboss-as-7.1.0.Final release need to be updated with the attached standalone.xml, standalone.conf, and the database driver modules. The exact steps would be:

  1. Create a demo directory to contain the files. I use /tmp/as710conf, so if you use the same, no changes need to be made to the following directions or configuration files.
  2. download http://download.jboss.org/jbossas/7.1/jboss-as-7.1.0.Final/jboss-as-7.1.0.Final.zip
  3. unzip jboss-as-7.1.0.Final.zip
  4. Create a link from jbossas-7 to jboss-as-7.1.0.Final, or copy the jboss-as-7.1.0.Final directory to jbossas-7
    1. ln -s jboss-as-7.1.0.Final jbossas-7
  5. Download the attachments on this blog
  6. unzip bin.zip to get the bin/{standalone.conf,standalone.sh} files
  7. cp bin/* to jbossas-7/bin
  8. Edit the jbossas-7/bin/standalone.conf file to change any of the
  9. unzip the modules.zip from within the jbossas-7 directory to add the modules for mysql, mongodb, and switchyard to the server modules. (Note, the attached modules.zip does not contain the switchyard modules as this made the attachment too large. To build the full modules.zip, clone the https://github.com/openshift/jboss-as7-modules repo and do a 'gradle createModuleZip' to build it.)



There are several environment variables referenced in the standalone.xml from the OpenShift JBossAS7 cartridge standalone.xml and standalone.conf files. They are:


# OPENSHIFT_GEAR_NAME is the NAME of the application as passed to the rhc create app -a NAME … command

# OPENSHIFT_REPO_DIR is the git repository of the application deployment. For reproducing the standalone configuration
# it has no meaningful value as it is only used to pickup application specific overrides of the server
# configuration files.

# OPENSHIFT_GEAR_DIR is the root directory of the application. 

# OPENSHIFT_GEAR_TYPE is jbossas-7 for a jbossas cartridge. This is also used as the root of
# the jbossas7 application server associated with the application. In the OpenShift environment, each
# application is associated with a user that has a copy of the jboss-as-7.1.0.Final server contents installed to ${OPENSHIFT_GEAR_DIR}${OPENSHIFT_GEAR_TYPE}, e.g., /tmp/demo/jbossas-7.

# OPENSHIFT_DB_TYPE is the type of the embedded database configured using the rhc-ctl-app command:
# rhc-ctl-app -a demo -e add-mysql-5.1
# This will be empty if no database cartridge has been embedded.
# OPENSHIFT_DB_HOST gives the IP address the embedded database is listening on
# OPENSHIFT_DB_PORT gives the port the embedded database is listening on
# OPENSHIFT_DB_USERNAME gives the configured username to access the embedded database
# OPENSHIFT_DB_PASSWORD gives the configured username to access the embedded database

# OPENSHIFT_INTERNAL_IP is the local ip address to bind the server's services to. Typically you would use
# localhost/ for your local environment.

# OPENSHIFT_JBOSS_CLUSTER is the ip address[port] for the TCPPING initial_hosts property used by the jgroups
# subsystem configuration. This is used when scaling of the application is enabled in OpenShift. For local, single server
# testing this will not be used.

# OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT is the port used by the TCP groups protocol bind_port property.

# OPENSHIFT_GEAR_DNS is the public dns name of the server hosting the application created by rhc app create -a … .
# For an application named demo, in a domain named jbossdev, the DNS name would be: demo-jbossdev.rhcloud.com.
# This is used by the jgroups subsystem configuration as the ip address/hostname for the external_addr property used to
# communicate with other jboss instances. For a local, single server testing this should be the same as the

# The node_profile value is derived from the type of node the application is running on. The default is small as that is the free
# offering which provide 500Mb of memory to the application. 
node_profile = small


The relevant values for these in the attached standalone.conf file that I tested with are:


#### Edit this variables for your test environment
export OPENSHIFT_GEAR_NAME=as710conf
export OPENSHIFT_GEAR_DIR=/tmp/as710conf/
export OPENSHIFT_GEAR_TYPE=jbossas-7
export node_profile=small


Running the OpenShift configuration is realized by executing the standalone.sh from your jbossas-7/bin directory:


[152](ironmaiden:as710conf) > cd /tmp/as710conf/jbossas-7/bin/
[153](ironmaiden:bin) > ./standalone.sh 

  JBoss Bootstrap Environment

  JBOSS_HOME: /tmp/as710conf/jbossas-7

  JAVA: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java

  JAVA_OPTS: -d32 -client -Xmx256m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Djboss.node.name= -Djgroups.bind_addr=


05:47:38,320 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
05:47:38,490 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
05:47:38,554 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
05:47:39,265 INFO  [org.xnio] XNIO Version 3.0.3.GA
05:47:39,265 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
05:47:39,274 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
05:47:39,283 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
05:47:39,294 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
05:47:39,297 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
05:47:39,307 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
05:47:39,328 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
05:47:39,333 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
05:47:39,336 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
05:47:39,342 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final
05:47:39,359 INFO  [org.jboss.as.connector] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
05:47:39,372 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
05:47:39,480 INFO  [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service
05:47:39,503 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
05:47:39,518 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
05:47:39,567 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-7) JBoss Web Services - Stack CXF Server 4.0.1.GA
05:47:39,687 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http--
05:47:39,837 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory /tmp/as710conf/jbossas-7/standalone/deployments
05:47:39,853 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /
05:47:39,853 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /
05:47:39,941 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
05:47:39,950 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 1922ms - Started 134 of 205 services (70 services are passive or on-demand)



Diff of Configuration Files

The full difference from the base standalone.xml configuration you would see in a current jbossas-7 cartridge application on OpenShift vs the standalone.xml seen in the jboss-as-7.1.0.Final/standalone/configuration/standalone.xml is show below.


[260](ironmaiden:tmp) > diff -w /tmp/demo/.openshift/config/standalone.xml /home/git/JBossAS/Downloads/jboss-as-7.1.0.Final/standalone/configuration/standalone.xml
<         <extension module="org.jboss.as.clustering.jgroups"/>
>         <extension module="org.jboss.as.configadmin"/>
>         <extension module="org.jboss.as.osgi"/>
>         <extension module="org.jboss.as.webservices"/>
<     <!--management>
>     <management>
<     </management-->
>     </management>
<             <!--console-handler name="CONSOLE">
>             <console-handler name="CONSOLE">
<             </console-handler-->
>             </console-handler>
<                     <pattern-formatter pattern="%d{yyyy/MM/dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
>                     <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
<                     <!--handler name="CONSOLE"/-->
>                     <handler name="CONSOLE"/>
>         <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/>
<                 <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
<                     <connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url>
>                 <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
>                     <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<                 <datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">
<                     <connection-url>jdbc:mysql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url>
<                     <driver>mysql</driver>
<                     <security>
<                       <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>
<                       <password>${env.OPENSHIFT_DB_PASSWORD}</password>
<                     </security>
<                 </datasource>
<                 <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">
<                     <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url>
<                     <driver>postgresql</driver>
<                     <security>
<                       <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>
<                       <password>${env.OPENSHIFT_DB_PASSWORD}</password>
<                     </security>
<                 </datasource>
<                     <driver name="mysql" module="com.mysql.jdbc">
<                         <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<                     </driver>
<                     <driver name="postgresql" module="org.postgresql.jdbc">
<                         <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<                     </driver>
<                 <stateful default-access-timeout="5000" cache-ref="simple" clustered-cache-ref="clustered"/>
>                 <stateful default-access-timeout="5000" cache-ref="simple"/>
<             <!--mdb>
>             <mdb>
<             </mdb-->
>             </mdb>
<                 <cache name="clustered" passivation-store-ref="infinispan" aliases="StatefulTreeCache"/>
<                 <cluster-passivation-store name="infinispan" cache-container="ejb"/>
<             <!--iiop enable-by-default="false" use-qualified-name="false"/-->
<         <subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="cluster">
<             <cache-container name="cluster" aliases="ha-partition" default-cache="default">
<                 <transport lock-timeout="60000"/>
<                 <replicated-cache name="default" mode="SYNC" batching="true">
<                     <locking isolation="REPEATABLE_READ"/>
<                 </replicated-cache>
<             </cache-container>
<             <cache-container name="web" aliases="standard-session-cache" default-cache="repl">
<                 <transport lock-timeout="60000"/>
<                 <replicated-cache name="repl" mode="ASYNC" batching="true">
<                     <file-store/>
<                 </replicated-cache>
<                 <replicated-cache name="sso" mode="SYNC" batching="true"/>
<                 <distributed-cache name="dist" mode="ASYNC" batching="true">
<                     <file-store/>
<                 </distributed-cache>
<             </cache-container>
<             <cache-container name="ejb" aliases="sfsb sfsb-cache" default-cache="repl">
<                 <transport lock-timeout="60000"/>
<                 <replicated-cache name="repl" mode="ASYNC" batching="true">
<                     <eviction strategy="LRU"/>
<                     <file-store/>
<                 </replicated-cache>
<                 <!-- Clustered cache used internally by EJB subsytem for managing the client-mapping(s) of
<                 the socketbinding referenced by the EJB remoting connector -->
<                 <replicated-cache name="remote-connector-client-mappings" mode="SYNC" batching="true"/>
<                 <distributed-cache name="dist" mode="ASYNC" batching="true">
<                     <eviction strategy="LRU"/>
<                     <file-store/>
<                 </distributed-cache>
<             </cache-container>
>         <subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="hibernate">
<                 <transport lock-timeout="60000"/>
<                 <local-cache name="local-query">
<                     <transaction mode="NONE"/>
>                 <local-cache name="entity">
>                     <transaction mode="NON_XA"/>
<                 <invalidation-cache name="entity" mode="SYNC">
<                     <transaction mode="NON_XA"/>
>                 <local-cache name="local-query">
>                     <transaction mode="NONE"/>
<                 </invalidation-cache>
<                 <replicated-cache name="timestamps" mode="ASYNC">
>                 </local-cache>
>                 <local-cache name="timestamps">
<                 </replicated-cache>
>                 </local-cache>
<                         <core-threads count="10"/>
<                         <queue-length count="10" />
<                         <max-threads count="10" />
>                     <core-threads count="50"/>
>                     <queue-length count="50"/>
>                     <max-threads count="50"/>
<                         <core-threads count="10"/>
<                         <queue-length count="10" />
<                         <max-threads count="10" />
>                     <core-threads count="50"/>
>                     <queue-length count="50"/>
>                     <max-threads count="50"/>
<         <subsystem xmlns="urn:jboss:domain:jgroups:1.0" default-stack="tcp">
<             <stack name="tcp">
<                 <transport type="TCP" socket-binding="jgroups-tcp"> 
<                           <property name="external_addr">${env.OPENSHIFT_GEAR_DNS}</property>
<                     <property name="external_port">${env.OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT}</property>
<                     <property name="bind_port">7600</property>
<                     <property name="bind_addr">${env.OPENSHIFT_INTERNAL_IP}</property>
<                 </transport>
<                 <protocol type="TCPPING">
<                           <property name="timeout">3000</property>
<                           <property name="initial_hosts">${env.OPENSHIFT_JBOSS_CLUSTER}</property>
<                           <property name="port_range">0</property>
<                           <property name="num_initial_members">1</property>
<                 </protocol>
<                 <protocol type="MERGE2"/>
<                 <protocol type="FD"/>
<                 <protocol type="VERIFY_SUSPECT"/>
<                 <protocol type="BARRIER"/>
<                 <protocol type="pbcast.NAKACK"/>
<                 <protocol type="UNICAST2"/>
<                 <protocol type="pbcast.STABLE"/>
<                 <protocol type="pbcast.GMS"/>
<                 <protocol type="UFC"/>
<                 <protocol type="MFC"/>
<                 <protocol type="FRAG2"/>
<                 <protocol type="AUTH">
<                         <property name="auth_class">org.jgroups.auth.MD5Token</property>
<                         <property name="token_hash">SHA</property>
<                         <property name="auth_value">${env.OPENSHIFT_JBOSS_CLUSTER}</property>
<                 </protocol>
<                 <!--protocol type="pbcast.STATE_TRANSFER"/>
<                 <protocol type="pbcast.FLUSH"/-->
<             </stack>
>         <subsystem xmlns="urn:jboss:domain:jmx:1.1">
>             <show-model value="true"/>
>             <remoting-connector/>
>         <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">
>             <properties>
>                 <!-- Specifies the beginning start level of the framework -->
>                 <property name="org.osgi.framework.startlevel.beginning">1</property>
>             </properties>
>             <capabilities>
>                 <!-- modules registered with the OSGi layer on startup -->
>                 <capability name="javax.servlet.api:v25"/>
>                 <capability name="javax.transaction.api"/>
>                 <!-- bundles started in startlevel 1 -->
>                 <capability name="org.apache.felix.log" startlevel="1"/>
>                 <capability name="org.jboss.osgi.logging" startlevel="1"/>
>                 <capability name="org.apache.felix.configadmin" startlevel="1"/>
>                 <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/>
>             </capabilities>
>         </subsystem>
<             <connector name="remoting-connector" socket-binding="remoting"/>
>             <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>
<                         <login-module code="UsersRoles" flag="required"/>
>                         <login-module code="Remoting" flag="optional">
>                             <module-option name="password-stacking" value="useFirstPass"/>
>                         </login-module>
>                         <login-module code="RealmUsersRoles" flag="required">
>                             <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
>                             <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
>                             <module-option name="realm" value="ApplicationRealm"/>
>                             <module-option name="password-stacking" value="useFirstPass"/>
>                         </login-module>
<             <virtual-server name="default-host" enable-welcome-root="false">
>             <virtual-server name="default-host" enable-welcome-root="true">
>                 <alias name="example.com"/>
>         <subsystem xmlns="urn:jboss:domain:webservices:1.1">
>             <modify-wsdl-address>true</modify-wsdl-address>
>             <wsdl-host>${jboss.bind.address:}</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>
<             <loopback-address value="${env.OPENSHIFT_INTERNAL_IP}"/>
>             <inet-address value="${jboss.bind.address.management:}"/>
<             <loopback-address value="${env.OPENSHIFT_INTERNAL_IP}"/>
>             <inet-address value="${jboss.bind.address:}"/>
<         <socket-binding name="jgroups-tcp" port="7600"/>
<         <!--socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
<         <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/-->
>         <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
>         <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
>         <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
>         <socket-binding name="osgi-http" interface="management" port="8090"/>

Filter Blog

By date:
By tag: