diff --git a/framework/appserver/templates/jboss422/deploy.sh b/framework/appserver/templates/jboss422/deploy.sh
index 27b2af9a6c..d308728b26 100755
--- a/framework/appserver/templates/jboss422/deploy.sh
+++ b/framework/appserver/templates/jboss422/deploy.sh
@@ -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"
\ No newline at end of file
diff --git a/framework/appserver/templates/jboss422/patches/derby-ds.xml b/framework/appserver/templates/jboss422/patches/derby-ds.xml
new file mode 100644
index 0000000000..d38a9cbd15
--- /dev/null
+++ b/framework/appserver/templates/jboss422/patches/derby-ds.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ OFBizDS
+
+
+ jdbc:derby:${jboss.server.data.dir}${/}derby${/}ofbiz;create=true
+
+
+ org.apache.derby.jdbc.EmbeddedDriver
+
+
+ sa
+
+
+
+ 2
+
+
+ 5
+
+
+ 15
+
+
+
+
+
+ jboss:service=OFBiz
+
+
+
+
diff --git a/framework/appserver/templates/jboss422/patches/derby-ol-ds.xml b/framework/appserver/templates/jboss422/patches/derby-ol-ds.xml
new file mode 100644
index 0000000000..38b5c9d9bf
--- /dev/null
+++ b/framework/appserver/templates/jboss422/patches/derby-ol-ds.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ OFBizOlapDS
+
+
+ jdbc:derby:${jboss.server.data.dir}${/}derby${/}ofbizolap;create=true
+
+
+ org.apache.derby.jdbc.EmbeddedDriver
+
+
+ sa
+
+
+
+ 2
+
+
+ 5
+
+
+ 15
+
+
+
+
+
+ jboss:service=OFBizOlap
+
+
+
+
diff --git a/framework/appserver/templates/jboss422/patches/jboss-ee-cfg.patch b/framework/appserver/templates/jboss422/patches/jboss-ee-cfg.patch
new file mode 100644
index 0000000000..6d7ff163ab
--- /dev/null
+++ b/framework/appserver/templates/jboss422/patches/jboss-ee-cfg.patch
@@ -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 @@
+
+
+
+-
++
+
+
+-
+
+
+-
++
+
+- -->
++
+
++ -->
++
+
+
++
++ -->
++
+
+
+
+
++
++ -->
++
+
+
+ &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
-