By default JBoss requires a number of work/tmp directories to be available at runtime.
For example work, tmp, data and log are created and used under the running profile to store application data, compiled JSPs, transaction details and log files.
By default it is assumed that these directories will have the jboss-as/server/profile directory as its parent.
However it is possible to take these working directories and relocate them outside of the standard JBoss directory structure.
To relocate the logging directory specify the new location via the following system property
-Djboss.server.log.dir=/tmp/prod/log
To relocate the data directory specify the new location via the following system property
-Djboss.server.data.dir=/tmp/prod/data
To relocate the tmp directory specify the new location via the following system property
-Djboss.server.temp.dir=/tmp/prod/data
1. Gotchas
Unfortunately its not just as easy as specifying system properties. Some xml configuration changes are also required.
In the jboss-as/server/profile/conf/jboss-service.xml file, edit XML configuration for the following mbean to specify the location of its data directory
<mbean code="org.jboss.system.pm.AttributePersistenceService"
name="jboss:service=AttributePersistenceService"
xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">
<!-- the AttributePersistenceService is persistent, itself -->
<attribute name="AttributePersistenceManagerClass">org.jboss.system.pm.XMLAttributePersistenceManager</attribute>
<attribute name="AttributePersistenceManagerConfig">
<data-directory>file://${jboss.server.data.dir}/xmbean-attrs</data-directory>
</attribute>
<attribute name="ApmDestroyOnServiceStop">false</attribute>
<attribute name="VersionTag"></attribute>
</mbean>
The directory mbean-attrs directory has to exist within the directory or the container will fail to start.
The embedded Tomcat instance also has to be informed of the location of where it has to store its compiled JSP pages. This is done by editing the jboss-as/server/noc-default/deploy/jbossweb.sar/server.xml and the workDir attribute
<Host name="localhost" workDir="${jboss.server.work.dir}">
Finally run JBoss with the required system properties
./run.sh -c prod -Djboss.server.data.dir=/tmp/prod/data -Djboss.server.temp.dir=/tmp/prod/tmp -Djboss.server.log.dir=/tmp/prod/log -Djboss.server.work.dir=/tmp/prod/work
Thursday, June 16, 2011
Thursday, April 7, 2011
Keys for client certificates in SSL
Generate the server keystore and export the servers key
keytool -genkey -alias alias -keystore app.keystore
Export the cert and convert for the client app
keytool -export -alias alias -keystore app.keystore -file exported-der.crt
openssl x509 -out exporter-pem.crt -outform pem -in exported-der.crt -inform der
Generate the client cert
keytool -genkey -alias clientCert -keystore client.keystore
keytool -export -alias clientcert -keystore client.keystore -file exported-client-der.crt
Import the client cert into the servers truststore
keytool -import -alias clientCert -keystore app.truststore -file exported-client-der.crt
For non java apps extract the clients private key using Portecle to make it available to the app
Add the servers key to the clients truststore e.g. keytool -import........
keytool -genkey -alias alias -keystore app.keystore
Export the cert and convert for the client app
keytool -export -alias alias -keystore app.keystore -file exported-der.crt
openssl x509 -out exporter-pem.crt -outform pem -in exported-der.crt -inform der
Generate the client cert
keytool -genkey -alias clientCert -keystore client.keystore
keytool -export -alias clientcert -keystore client.keystore -file exported-client-der.crt
Import the client cert into the servers truststore
keytool -import -alias clientCert -keystore app.truststore -file exported-client-der.crt
For non java apps extract the clients private key using Portecle to make it available to the app
Add the servers key to the clients truststore e.g. keytool -import........
Friday, March 4, 2011
Sort requests using response times from apache access logs
cat apache_access.log | awk '/Mar/ {print $1,$6,$7,$10}'|sort -k4 -n
Tuesday, February 22, 2011
Classloading isolation in SOA-P
Add the file jboss-classloading.xml to the META-INF directory with the following contents
<classloading xmlns="urn:jboss:classloading:1.0"
domain="IsolatedDomain"
parent-first="false"
import-all="true"
export-all="NON_EMPTY"/>
<classloading xmlns="urn:jboss:classloading:1.0"
domain="IsolatedDomain"
parent-first="false"
import-all="true"
export-all="NON_EMPTY"/>
Thursday, February 17, 2011
Handling tab delimited fields in Smooks
The separator field is passed as unicode
<?xml version="1.0"?> <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd"> <csv:reader fields="GenbankAccessionNumber_Nucleotide,GenbankAccessionNumber_Protein1,Protein_CR1,GenbankAccessionNumber_Protein2,Protein_CR2" separator="	"/> </smooks-resource-list>
Sample Twiddle scripts
To get the active session count for your own app.
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=Manager,path=/jmx-console,host=localhost activeSessions
To retrieve the thread queue size
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:service=ThreadPool QueueSize
To retrieve active thread counts
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
To retrieve the amount of free memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo FreeMemory
To get all processing stats from the HTTP acceptor on JBoss
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=GlobalRequestProcessor,name=http-127.0.0.1-8080
Invoke a thread dump
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadDump
Invoke a listing of CPU utilization
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadCpuUtilization
Total System memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo TotalMemory
Active Thread Count
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=Manager,path=/jmx-console,host=localhost activeSessions
To retrieve the thread queue size
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:service=ThreadPool QueueSize
To retrieve active thread counts
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
To retrieve the amount of free memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo FreeMemory
To get all processing stats from the HTTP acceptor on JBoss
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=GlobalRequestProcessor,name=http-127.0.0.1-8080
Invoke a thread dump
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadDump
Invoke a listing of CPU utilization
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadCpuUtilization
Total System memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo TotalMemory
Active Thread Count
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
Retrieving ESB exceptions into jBPM
When integrating ESB and jBPM it is possible to take an different jBPM transition in the case that the ESB service throws an exception.
When a ESB service throws an exception, the action pipeline returns the exception details in the Fault section of the message and also in the message Body. As of SOA-P 5.0.2 there is no way by which the contents of the Fault section can be passed back to the invoking jBPM process. However it is possible to retrieve the exception fault code, reason and throwable fields from the ESB message body. The key is to wrap the fields using the single quote character [']
For example
When a ESB service throws an exception, the action pipeline returns the exception details in the Fault section of the message and also in the message Body. As of SOA-P 5.0.2 there is no way by which the contents of the Fault section can be passed back to the invoking jBPM process. However it is possible to retrieve the exception fault code, reason and throwable fields from the ESB message body. The key is to wrap the fields using the single quote character [']
For example
<node name="node1"> <action name="ShipItAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler"> <esbCategoryName>TestSVC</esbCategoryName> <esbServiceName>Svc2</esbServiceName> <bpmToEsbVars> <mapping bpm="theBody" esb="BODY_CONTENT" /> </bpmToEsbVars> <esbToBpmVars> <mapping esb="BODY_CONTENT" bpm="theBody" /> <mapping esb="body.'org.jboss.soa.esb.message.fault.code'" bpm="faultCode" default="" /> <mapping esb="body.'org.jboss.soa.esb.message.fault.throwable'" bpm="faultThrowable" default="" /> <mapping esb="body.'org.jboss.soa.esb.message.fault.reason'" bpm="faultReason" default="" /> </esbToBpmVars> <exceptionTransition>exceptionNOC</exceptionTransition> </action> <transition to="end-state1"></transition> <transition to="ExceptionNode" name="exceptionNOC"></transition> </node>
Subscribe to:
Posts (Atom)