Starting Mulgara

With Mulgara moving to Java 1.5, I figured I'd kick the tires.

I took an old Kowari init script and created a new Mulgara init script.  Idea was to drop the script in /etc/init.d/mulgara and link to appropriate start and stop in /etc/rc3.d and /etc/rc0.d respectively.  My script looked like:
 1  #!/bin/ksh
 2
 3  OUTPUT_DIR=/var/opt/mulgara
 4  MULGARA_HOME=${OUTPUT_DIR}/mulgara-1.0.0
 5  MULGARA_JAR=${MULGARA_HOME}/dist/mulgara-1.0.0.jar
 6  JAVA_HOME=/var/opt/mulgara/jdk-1.5.0
 7  PORT=9000
 8
 9  cd ${OUTPUT_DIR}
10
11  if [ "$1" = "" -o "$1" = "start" ]
12  then
13
14      ${JAVA_HOME}/bin/java -jar ${MULGARA_JAR} -a ${OUTPUT_DIR} -p ${PORT} -l file:${MULGARA_HOME}/conf/log4j-mulgara.xml &
15
16  elif [ "$1" = "stop" ]
17  then
18
19      ${JAVA_HOME}/bin/java -jar ${MULGARA_JAR} -x
20
21  else
22
23    echo "Usage: $0 [ start | stop ]" 
24
25  fi

However, after deploying the bundled descriptors, I found I couldn't use them., getting an "Unrecognized XSLTC extension" for mulgaraDescriptor:descriptor. You just have to love how XML was included in the JDK. Since the bundlded Xalan was updated to 2.7.0, I figured I just needed to tweak my script and override the bundled XML parsers. The updated script looks like:
 1  #!/bin/ksh
 2
 3  OUTPUT_DIR=/var/opt/mulgara
 4  MULGARA_HOME=${OUTPUT_DIR}/mulgara-1.0.0
 5  MULGARA_JAR=${MULGARA_HOME}/dist/mulgara-1.0.0.jar
 6  JAVA_HOME=/var/opt/mulgara/jdk-1.5.0
 7  PORT=9000
 8
 9  cd ${OUTPUT_DIR}
10
11  if [ "$1" = "" -o "$1" = "start" ]
12  then
13
14      ${JAVA_HOME}/bin/java -Djava.endorsed.dirs=${MULGARA_HOME}/lib/endorsed \
15      -jar ${MULGARA_JAR} -a ${OUTPUT_DIR} -p ${PORT} -l file:${MULGARA_HOME}/conf/log4j-mulgara.xml &
16
17  elif [ "$1" = "stop" ]
18  then
19
20      ${JAVA_HOME}/bin/java -jar ${MULGARA_JAR} -x
21
22  else
23
24    echo "Usage: $0 [ start | stop ]" 
25
26  fi

I created a lib/endorsed directory and linked xalan-2.7.0.jar, xercesImpl.jar and xmlParserAPIs.jar from the parent directory. This wasn't enough though. Apparently with Xalan 2.7 they pulled out the serializers. I added serializer.jar from the Xalan-J-2.7.0 distribution to lib and created a link in lib/endorsed. With these changes, starting Mulgara with the script and browsing to localhost:9000/webservices/descriptor/ and selecing the Invoke button to see all deploy descriptors I was happy to see the list of descriptors.

Note: While at Sun, I was having some issues with how my hostname was being resolved. getCanonicalHostName() was not returning a fully qualified domain name and this was resulting in some NPEs. In order to address this, I needed to specify DNS as the way to resolve names. I added the following lines after line 14 in the script listed above:

-Dsun.net.spi.nameservice.provider.1=dns,sun \
-Dsun.net.spi.nameservice.nameservers=129.147.4.1,129.147.62.1,129.152.1.19 \
-Dsun.net.spi.nameservice.domain=Central.Sun.COM \

Figured Sun isn't the only one out there using files or NIS as the default way to handle hostname resolution and I should capture it somewhere...

original page by Rich Long