Thursday, July 8, 2010

A simple build script for ejbca on debian. It expects you to pull the appropriate jboss and ejbca archives into $SOURCE
It's based mostly on


set -e
export JBOSS_HOME=/opt/jboss
export ANT_OPTS=-Xmx512m
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_OPTS="-server -Xms128m -Xmx512m"
export JAVAC_OPTS="-Dno-xdoc"

echonice() {
echo "==================================================="
echo "$1"
echo "==================================================="
cd /opt/
rm -rf jboss/ ejbca/
unzip $SOURCE/
unzip $SOURCE/

mv jboss-4.2* jboss/
mv ejbca_3* ejbca/

cd /opt/ejbca/conf && for file in `ls *.sample`; do cp $file `echo $file|sed -e 's/.sample//'`; done

#sed -i -e 's/httpsserver.hostname=localhost/'

echonice "Debian testing has a bug that breaks networking in java \n Refer to"

sleep 5;

cd /opt/ejbca/ && ant bootstrap

#echo "Please start jboss in another shell using /opt/jboss/bin/ -b"
echonice "Attempting to start jboss in another shell"
/opt/jboss/bin/ -b &
sleep 60;

echonice "Attempting install"
ant install
sleep 20;

echonice "Attempting to kill jboss"
kill `ps aux|grep jboss|grep|awk '{print $2}'`

sleep 20;

echonice "Starting ant deploy"
ant deploy

echonice "Final Jboss Startup"
/opt/jboss/bin/ -b

If you are trying to get ejbca to work and run into this error on debian, have a look at this debian bug 560044

[echo] ca init AdminCA1 "CN=AdminCA1,O=EJBCA Sample,C=SE" soft null 2048 RSA 3650 null SHA1WithRSA conf/
[java] Initializing CA
[java] Generating rootCA keystore:
[java] CA name: AdminCA1
[java] DN: CN=AdminCA1,O=EJBCA Sample,C=SE
[java] CA token type: soft
[java] CA token password: null
[java] Keyspec: 2048
[java] Keytype: RSA
[java] Validity (days): 3650
[java] Policy ID: null
[java] Signature alg: SHA1WithRSA
[java] CA token properties: null
[java] Initalizing Temporary Authorization Module.
[java] javax.naming.CommunicationException: Could not obtain connection to any of these urls: and discovery failed with error: javax.naming.CommunicationException: Network is unreachable [Root exception is Network is unreachable] [Root exception is javax.naming.CommunicationException: Failed to connect to server [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server [Root exception is Network is unreachable]]]
[java] Java Result: -1