updated jboss422 deployment configurations:

1. now setups up derby (in jboss) 
2. configures entityengine.xml to use jboss datasource/tx manager
3. removed more conflicting libraries
4. no longer edits run.sh; adds OFBIZ_HOME to run.conf; now auto-installs config



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@663736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Zeneski
2008-06-05 21:02:33 +00:00
parent 0ef02f6562
commit 2b891a9aae
6 changed files with 298 additions and 257 deletions
@@ -7,6 +7,7 @@
# in the JBoss deploy directory #
# #
#################################
DERBY_VERSION="10.4.1.3"
if [ -f "./META-INF/application.xml" ]; then
rm -rf META-INF
@@ -19,7 +20,36 @@ if [ -f "./lib/ofbiz-base.jar" ]; then
echo "removed wars"
fi
# move log4j.xml and jndi.properties
# install derby
if [ ! -f "../../lib/derby-$DERBY_VERSION.jar" ]; then
cp "${ofbizHome}/framework/entity/lib/jdbc/derby-$DERBY_VERSION.jar" ../../lib/
echo "installed derby-$DERBY_VERSION"
fi
# install derby plugin
if [ ! -f "../../lib/derby-plugin.jar" ]; then
cp ../../../../docs/examples/varia/derby-plugin.jar ../../lib/
echo "installed derby-plugin.jar"
fi
# install derby datasource
if [ ! -f "../derby-ds.xml" ]; then
cp ${ofbizHome}/framework/appserver/templates/jboss422/patches/derby*.xml ..
echo "derby datasource configuration installed"
fi
# configure the jboss entity engine (patch) configuration
if [ ! -f "${ofbizHome}/framework/entity/config/entityengine-jboss422.xml" ]; then
patch -i ${ofbizHome}/framework/appserver/templates/jboss422/patches/jboss-ee-cfg.patch -o ${ofbizHome}/framework/entity/config/entityengine-jboss422.xml ${ofbizHome}/framework/entity/config/entityengine.xml
echo "created entityengine-jboss.xml"
fi
# move entityengine.xml, log4j.xml and jndi.properties
if [ -f "${ofbizHome}/framework/entity/config/entityengine-jboss422.xml" ]; then
mv ${ofbizHome}/framework/entity/config/entityengine.xml ${ofbizHome}/framework/entity/config/entityengine.xml.jbak
mv ${ofbizHome}/framework/entity/config/entityengine-jboss422.xml ${ofbizHome}/framework/entity/config/entityengine.xml
echo "moved entityengine.xml"
fi
if [ -f "${ofbizHome}/framework/base/config/log4j.xml" ]; then
mv ${ofbizHome}/framework/base/config/log4j.xml ${ofbizHome}/framework/base/config/_log4j.xml.bak
echo "moved ${ofbizHome}/framework/base/config/log4j.xml"
@@ -32,7 +62,7 @@ fi
# copy all lib files
mkdir lib
<#list classpathJars as jar>
<#if (!jar.contains("j2eespec") && !jar.contains("geronimo") && !jar.contains("catalina") && !jar.contains("mx4j") && !jar.contains("commons-el") && !jar.equals("mail.jar"))>
<#if (!jar.contains("j2eespec") && !jar.contains("geronimo") && !jar.contains("catalina") && !jar.contains("mx4j") && !jar.contains("derby-") && !jar.contains("commons-logging") &&!jar.contains("commons-collections") &&!jar.contains("commons-codec") && !jar.contains("commons-el") && !jar.contains("avalon-framework") && !jar.contains("bsh") && !jar.contains("bsf") && !jar.contains("antlr") && !jar.contains("mail.jar"))>
cp ${jar} ./lib
</#if>
</#list>
@@ -65,7 +95,12 @@ if [ -f "../../lib/bsh.jar" ]; then
echo "updated bsh.jar"
fi
# revert log4j.xml and jndi.properties
# revert entityengine.xml log4j.xml and jndi.properties
if [ -f "${ofbizHome}/framework/entity/config/entityengine.xml.jbak" ]; then
mv ${ofbizHome}/framework/entity/config/entityengine.xml ${ofbizHome}/framework/entity/config/entityengine-jboss422.xml
mv ${ofbizHome}/framework/entity/config/entityengine.xml.jbak ${ofbizHome}/framework/entity/config/entityengine.xml
echo "fixed entityengine.xml"
fi
if [ -f "${ofbizHome}/framework/base/config/_log4j.xml.bak" ]; then
mv ${ofbizHome}/framework/base/config/_log4j.xml.bak ${ofbizHome}/framework/base/config/log4j.xml
echo "fixed ${ofbizHome}/framework/base/config/log4j.xml"
@@ -75,5 +110,11 @@ if [ -f "${ofbizHome}/framework/base/config/_jndi.properties.bak" ]; then
echo "fixed ${ofbizHome}/framework/base/config/jndi.properties"
fi
# setup the OFBIZ_HOME by updating run.conf
if [ ! -f "../../../../bin/run.conf.obak" ]; then
mv ../../../../bin/run.conf ../../../../bin/run.conf.obak
cp ${ofbizHome}/setup/jboss422/run.conf ../../../../bin/run.conf
echo "modifed bin/run.conf (with backup)"
fi
echo "\n"
echo "make sure run.sh includes -Dofbiz.home=${ofbizHome} as part of the JAVA_OPTS variable"
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- The Derby embedded database JCA connection factory config
$Id: derby-ds.xml,v 1.1.4.1 2004/11/03 13:28:39 loubyansky Exp $ -->
<datasources>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>OFBizDS</jndi-name>
<!-- for in-process persistent db, saved when jboss stops. The
org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->
<connection-url>jdbc:derby:${jboss.server.data.dir}${/}derby${/}ofbiz;create=true</connection-url>
<!-- The driver class -->
<driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
<!-- The login and password -->
<user-name>sa</user-name>
<password></password>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>2</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>5</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<idle-timeout-minutes>15</idle-timeout-minutes>
<!-- Whether to check all statements are closed when the connection is returned to the pool,
this is a debugging feature that should be turned off in production -->
<track-statements/>
<!-- This mbean can be used when using in process persistent derby -->
<depends>jboss:service=OFBiz</depends>
</local-tx-datasource>
<mbean code="org.jboss.jdbc.DerbyDatabase" name="jboss:service=OFBiz"/>
</datasources>
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- The Derby embedded database JCA connection factory config
$Id: derby-ds.xml,v 1.1.4.1 2004/11/03 13:28:39 loubyansky Exp $ -->
<datasources>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>OFBizOlapDS</jndi-name>
<!-- for in-process persistent db, saved when jboss stops. The
org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->
<connection-url>jdbc:derby:${jboss.server.data.dir}${/}derby${/}ofbizolap;create=true</connection-url>
<!-- The driver class -->
<driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
<!-- The login and password -->
<user-name>sa</user-name>
<password></password>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>2</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>5</max-pool-size>
<!-- The time before an unused connection is destroyed -->
<idle-timeout-minutes>15</idle-timeout-minutes>
<!-- Whether to check all statements are closed when the connection is returned to the pool,
this is a debugging feature that should be turned off in production -->
<track-statements/>
<!-- This mbean can be used when using in process persistent derby -->
<depends>jboss:service=OFBizOlap</depends>
</local-tx-datasource>
<mbean code="org.jboss.jdbc.DerbyDatabase" name="jboss:service=OFBizOlap"/>
</datasources>
@@ -0,0 +1,78 @@
Index: framework/entity/config/entityengine.xml
===================================================================
--- framework/entity/config/entityengine.xml (revision 661518)
+++ framework/entity/config/entityengine.xml (working copy)
@@ -28,15 +28,15 @@
<!-- the transaction factory class to use, one is needed for each way of getting JTA interfaces -->
<!-- Use this one for Geronimo -->
- <transaction-factory class="org.ofbiz.geronimo.GeronimoTransactionFactory"/>
+ <!--<transaction-factory class="org.ofbiz.geronimo.GeronimoTransactionFactory"/>-->
<!-- Use this one for getting the JTA objects from JNDI -->
- <!-- NOTE: to use the JndiFactory you must specify the necessary JNDI properties
+ <!-- NOTE: to use the JndiFactory you must specify the necessary JNDI properties -->
<transaction-factory class="org.ofbiz.entity.transaction.JNDIFactory">
<user-transaction-jndi jndi-server-name="default" jndi-name="java:comp/UserTransaction"/>
- <transaction-manager-jndi jndi-server-name="default" jndi-name="java:comp/UserTransaction"/>
+ <transaction-manager-jndi jndi-server-name="default" jndi-name="java:/TransactionManager"/>
</transaction-factory>
- -->
+
<!--
It is common to use UserTransaction for the TransactionManager, but if that doesn't work, try this: <transaction-manager-jndi jndi-server-name="default" jndi-name="java:comp/TransactionManager"/>
Common UserTransaction locations:
@@ -160,6 +160,7 @@
<read-data reader-name="seed-initial"/>
<read-data reader-name="demo"/>
<read-data reader-name="ext"/>
+ <!--
<inline-jdbc
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver"
jdbc-uri="jdbc:derby:ofbiz;create=true"
@@ -168,7 +169,8 @@
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="250"/>
- <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+ -->
+ <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OFBizDS" isolation-level="ReadCommitted"/>
</datasource>
<datasource name="localderbyodbc"
helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
@@ -179,6 +181,7 @@
use-pk-constraint-names="false"
use-indices-unique="false"
alias-view-columns="false">
+ <!--
<inline-jdbc
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver"
jdbc-uri="jdbc:derby:ofbizodbc;create=true"
@@ -187,7 +190,8 @@
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="250"/>
- <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+ -->
+ <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OFBizOdbcDS" isolation-level="ReadCommitted"/>
</datasource>
<datasource name="localderbyolap"
helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
@@ -202,6 +206,7 @@
<read-data reader-name="seed-initial"/>
<read-data reader-name="demo"/>
<read-data reader-name="ext"/>
+ <!--
<inline-jdbc
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver"
jdbc-uri="jdbc:derby:ofbizolap;create=true"
@@ -210,7 +215,8 @@
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="250"/>
- <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+ -->
+ <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OFBizOlapDS" isolation-level="ReadCommitted"/>
</datasource>
<datasource name="localcloudscape"
@@ -0,0 +1,51 @@
## -*- shell-script -*- ######################################################
## ##
## JBoss Bootstrap Script Configuration ##
## ##
##############################################################################
### $Id: run.conf 62747 2007-05-02 17:43:36Z dimitris@jboss.org $
#
# This file is optional; it may be removed if not needed.
#
#
# Specify the maximum file descriptor limit, use "max" or "maximum" to use
# the default, as queried by the system.
#
# Defaults to "maximum"
#
#MAX_FD="maximum"
#
# Specify the profiler configuration file to load.
#
# Default is to not load profiler configuration file.
#
#PROFILER=""
#
# Specify the location of the Java home directory. If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"
#
# Specify the exact Java VM executable to use.
#
#JAVA=""
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
#JAVA_OPTS="-Xmx1024M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="-Xmx512M -XX:PermSize=512M -Dofbiz.home=${ofbizHome}"
fi
# Sample JPDA settings for remote socket debuging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
@@ -1,253 +0,0 @@
#!/bin/sh
### ====================================================================== ###
## ##
## JBoss Bootstrap Script ##
## ##
### ====================================================================== ###
### $Id: run.sh 64199 2007-07-23 15:57:38Z cazzius $ ###
DIRNAME=`dirname $0`
PROGNAME=`basename $0`
GREP="grep"
# Use the maximum available, or set MAX_FD != -1 to use that
MAX_FD="maximum"
#
# Helper to complain.
#
warn() {
echo "$PROGNAME: $*"
}
#
# Helper to puke.
#
die() {
warn $*
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false;
darwin=false;
linux=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;
Darwin*)
darwin=true
;;
Linux)
linux=true
;;
esac
# Read an optional running configuration file
if [ "x$RUN_CONF" = "x" ]; then
RUN_CONF="$DIRNAME/run.conf"
fi
if [ -r "$RUN_CONF" ]; then
. "$RUN_CONF"
fi
# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
if [ "$linux" = "true" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JBOSS_HOME" ] &&
JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$JAVAC_JAR" ] &&
JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
fi
# Setup JBOSS_HOME
if [ "x$JBOSS_HOME" = "x" ]; then
# get the full path (without any relative bits)
JBOSS_HOME=`cd $DIRNAME/..; pwd`
fi
export JBOSS_HOME
# Setup OFBIZ_HOME
export OFBIZ_HOME=${ofbizHome}
# Increase the maximum file descriptors if we can
if [ "$cygwin" = "false" ]; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ]; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
# use the system max
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ]; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# Setup the JVM
if [ "x$JAVA" = "x" ]; then
if [ "x$JAVA_HOME" != "x" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="java"
fi
fi
# Setup the classpath
runjar="$JBOSS_HOME/bin/run.jar"
if [ ! -f "$runjar" ]; then
die "Missing required file: $runjar"
fi
JBOSS_BOOT_CLASSPATH="$runjar"
# Tomcat uses the JDT Compiler
# Only include tools.jar if someone wants to use the JDK instead.
# compatible distribution which JAVA_HOME points to
if [ "x$JAVAC_JAR" = "x" ]; then
JAVAC_JAR_FILE="$JAVA_HOME/lib/tools.jar"
else
JAVAC_JAR_FILE="$JAVAC_JAR"
fi
if [ ! -f "$JAVAC_JAR_FILE" ]; then
# MacOSX does not have a seperate tools.jar
if [ "$darwin" != "true" -a "x$JAVAC_JAR" != "x" ]; then
warn "Missing file: JAVAC_JAR=$JAVAC_JAR"
warn "Unexpected results may occur."
fi
JAVAC_JAR_FILE=
fi
if [ "x$JBOSS_CLASSPATH" = "x" ]; then
JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH"
else
JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH"
fi
if [ "x$JAVAC_JAR_FILE" != "x" ]; then
JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JAVAC_JAR_FILE"
fi
# If -server not set in JAVA_OPTS, set it, if supported
SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
if [ "x$SERVER_SET" = "x" ]; then
# Check for SUN(tm) JVM w/ HotSpot support
if [ "x$HAS_HOTSPOT" = "x" ]; then
HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`
fi
# Enable -server if we have Hotspot, unless we can't
if [ "x$HAS_HOTSPOT" != "x" ]; then
# MacOS does not support -server flag
if [ "$darwin" != "true" ]; then
JAVA_OPTS="-server $JAVA_OPTS"
fi
fi
fi
# Setup JAVAOPTS for OFBIZ
JAVA_OPTS="-Dofbiz.home=$OFBIZ_HOME -Xmx512M $JAVA_OPTS"
# Setup JBosst Native library path
JBOSS_NATIVE_DIR="$JBOSS_HOME/bin/native"
if [ -d "$JBOSS_NATIVE_DIR" ]; then
if $cygwin ; then
export PATH="$JBOSS_NATIVE_DIR:$PATH"
JBOSS_NATIVE_DIR=`cygpath --dos "$JBOSS_NATIVE_DIR"`
fi
if [ "x$LD_LIBRARY_PATH" = "x" ]; then
LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR"
else
LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Djava.library.path=$JBOSS_NATIVE_DIR"
else
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_NATIVE_DIR"
fi
fi
# Setup JBoss specific properties
JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"
# Setup the java endorsed dirs
JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
fi
# Display our environment
echo "========================================================================="
echo ""
echo " JBoss Bootstrap Environment"
echo ""
echo " JBOSS_HOME: $JBOSS_HOME"
echo ""
echo " JAVA: $JAVA"
echo ""
echo " JAVA_OPTS: $JAVA_OPTS"
echo ""
echo " CLASSPATH: $JBOSS_CLASSPATH"
echo ""
echo "========================================================================="
echo ""
while true; do
if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then
# Execute the JVM in the foreground
"$JAVA" $JAVA_OPTS \
-Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
-classpath "$JBOSS_CLASSPATH" \
org.jboss.Main "$@"
JBOSS_STATUS=$?
else
# Execute the JVM in the background
"$JAVA" $JAVA_OPTS \
-Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
-classpath "$JBOSS_CLASSPATH" \
org.jboss.Main "$@" &
JBOSS_PID=$!
# Trap common signals and relay them to the jboss process
trap "kill -HUP $JBOSS_PID" HUP
trap "kill -TERM $JBOSS_PID" INT
trap "kill -QUIT $JBOSS_PID" QUIT
trap "kill -PIPE $JBOSS_PID" PIPE
trap "kill -TERM $JBOSS_PID" TERM
# Wait until the background process exits
WAIT_STATUS=0
while [ "$WAIT_STATUS" -ne 127 ]; do
JBOSS_STATUS=$WAIT_STATUS
wait $JBOSS_PID 2>/dev/null
WAIT_STATUS=$?
done
fi
# If restart doesn't work, check you are running JBossAS 4.0.4+
# http://jira.jboss.com/jira/browse/JBAS-2483
# or the following if you're running Red Hat 7.0
# http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
if [ $JBOSS_STATUS -eq 10 ]; then
echo "Restarting JBoss..."
else
exit $JBOSS_STATUS
fi
done