I experimented with jboss-as-7.1.1.Final using the "standalone"
framework support recently introduced. This is different than having
jboss7 as a separate "framework". If you get standalone support
working, then it shouldn't be too much trouble to add a specific
framework for jboss7. Some details are below. Let us know if you get
further along as I stopped once I encountered the file descriptor
mismatch between JBoss requirements and the current limit in
CloudFoundry.com.
Here is the link describing standalone support:
http://blog.cloudfoundry.com/2012/05/01/cloud-foundry-improves-support-for-background-processing/
Things I encountered were:
- Ports - Multiple ports are required with JBoss 7 default
configuration
- File Descriptors - JBoss7 uses between 500-600 file descriptors when
it starts up
JBoss7 default configuration requires multiple ephemeral ports to work
without errors whereas provides only a single VCAP_APP_PORT for http.
See this:
https://community.jboss.org/message/733704#733704
You can use a slimmed down configuration that has fewer open ports,
but at a minimum it appears you need the transactional ones in
addition to the http port. Below is a bash script I created that can
export ephemeral ports that could be added to JAVA_OPTS. When adding
this to the top of jboss-as-7.1.1.Final/bin/standalone.sh I was able
to get these ports added to the environment and substituted into the
jboss-as-7.1.1.Final/standalone/configuration/standalone.xml file by
referring to the environment variables.
Snippet of jboss-as-7.1.1.Final/standalone/configuration/
standalone.xml for port substitutions:
<socket-binding-group name="standard-sockets" default-
interface="public" port-offset="${jboss.socket.binding.port-offset:
0}">
<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="http" port="${jboss.http.port:8080}"/>
<socket-binding name="osgi-http" interface="management" port="$
{jboss.osgi.http.port:8090}"/>
<socket-binding name="remoting" port="${jboss.remoting.port:
4447}"/>
<socket-binding name="txn-recovery-environment" port="$
{jboss.txn.recovery.port:4712}"/>
<socket-binding name="txn-status-manager" port="$
{jboss.txn.status.port:4713}"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="$
{jboss.smtp.port:25}"/>
</outbound-socket-binding>
</socket-binding-group>
File Descriptors - CF.com is currently configured to support a maximum
of 256 file descriptors per process. Therefore jboss7 cannot with it's
default configuration until that limit is increased. If you are
running VCAP on your own, you should be able to increase the file
descriptors for your Cloud Foundry instance.
Bash script example of generating ephemeral ports for jboss that I
added to the top of standalone.sh:
#!/bin/bash
numPorts=8
generateRandomEphemeralPort ()
{
number=$RANDOM
let "number %= 28232"
let "number += 32768"
}
checkPortAvailability ()
{
linecount=`netstat -ant | sed -e '/^tcp/ !d' -e 's/^[^ ]* *[^ ]*
*[^ ]* *.*[\.:]\([0-9]*\) .*$/\1/' | sort -g | uniq | grep $number |
wc -l`
if [ $linecount -eq 0 ]; then
portAvail=1
else
portAvail=0
fi
}
exportEphemeralPorts ()
{
index=1
portAvail=0
while [ $index -le $numPorts ]
do
while [ $portAvail -eq 0 ]
do
generateRandomEphemeralPort
checkPortAvailability
done
let EPHEMERAL_PORT_$index=$number
export EPHEMERAL_PORT_$index
let "index += 1"
portAvail=0
done
}
exportEphemeralPorts
JAVA_OPTS="$JAVA_OPTS -Djboss.management.native.port=$EPHEMERAL_PORT_1
-Djboss.management.http.port=$EPHEMERAL_PORT_2 -
Djboss.management.https.port=$EPHEMERAL_PORT_3 -Djboss.http.port=
$VCAP_APP_PORT -Djboss.txn.recovery.port=$EPHEMERAL_PORT_4 -
Djboss.txn.status.port=$EPHEMERAL_PORT_5 -Djboss.smtp.port=
$EPHEMERAL_PORT_6 -Djboss.osgi.http.port=$EPHEMERAL_PORT_7 -
Djboss.remoting.port=$EPHEMERAL_PORT_8 "
echo "JAVA_OPTS = $JAVA_OPTS"