Author: indika
Date: Thu Jan 3 09:16:59 2008
New Revision: 11818
Log:
fix for an issue when runs multiple axis2 applications on a same host
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/Main.java
trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.bat
trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.sh
trunk/esb/java/modules/distribution/src/main/conf/wrapper.conf
trunk/esb/java/modules/distribution/src/main/docs/ESB_Extending.html
trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat
trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh
trunk/esb/java/modules/samples/src/main/scripts/build.xml
Modified: trunk/esb/java/modules/core/src/main/java/org/wso2/esb/Main.java
==============================================================================
--- trunk/esb/java/modules/core/src/main/java/org/wso2/esb/Main.java
(original)
+++ trunk/esb/java/modules/core/src/main/java/org/wso2/esb/Main.java Thu Jan
3 09:16:59 2008
@@ -72,7 +72,10 @@
long before = System.currentTimeMillis();
ServiceBusManager.initSystemProperties();
- Main esb = new Main();
+
+ createTempAxisWorkDirectory();
+
+ Main esb = new Main();
esb.setAxis2RepoLocation(esb.getEsbConfiguration().getFirstProperty(
ServerConfiguration.AXIS2_CONFIG_REPO_LOCATION));
@@ -86,6 +89,41 @@
log.info("WSO2 ESB started in " + (System.currentTimeMillis() -
before) + " ms");
}
+ /**
+ * Creates a temp directory for axis2 working dir
+ */
+ private static void createTempAxisWorkDirectory() {
+ String tempDirName = System.getProperty("java.io.tmpdir");
+ if (tempDirName != null || !"".equals(tempDirName)) {
+ File tempDir = new File(tempDirName, "_axis2");
+ if (tempDir.exists()) {
+ //Deletes already exists directory
+ deleteNonEmptyDirectory(tempDir);
+ }
+ tempDir.mkdirs();
+ }
+ }
+
+ /**
+ * Deletes a non-empty directory
+ *
+ * @param directory The current directory
+ * @return True if a deletion successes
+ */
+ private static boolean deleteNonEmptyDirectory(File directory) {
+ if (directory.isDirectory()) {
+ //delete all child directories and files
+ String[] children = directory.list();
+ for (int i = 0; i < children.length; i++) {
+ boolean success = deleteNonEmptyDirectory(new File(directory,
children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+ // The directory is now empty so delete it
+ return directory.delete();
+ }
public void startServer() throws ServiceBusException {
webServer = new TomcatServer(esbConfiguration);
Modified: trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.bat
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.bat
(original)
+++ trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.bat Thu Jan
3 09:16:59 2008
@@ -125,7 +125,7 @@
echo Using ESB_HOME: %ESB_HOME%
echo Using JAVA_HOME: %JAVA_HOME%
echo Using SYNAPSE_XML: %_SYNAPSE_XML%
-%_JAVACMD% %_SYNAPSE_XML%
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XMLGrammarCachingConfiguration
-Desb.home="%ESB_HOME%"
-Desb.xml="%ESB_HOME%\webapp\WEB-INF\classes\conf\server.xml"
-Daxis2.xml="%ESB_HOME%\webapp\WEB-INF\classes\conf\axis2.xml"
-Daxis2.repo="%ESB_HOME%\repository" -Djava.endorsed.dirs=%ESB_ENDORSED%
%_XDEBUG% -cp %ESB_CLASS_PATH% org.wso2.esb.Main START %ESB_CMD_LINE_ARGS%
+%_JAVACMD% %_SYNAPSE_XML% -Djava.io.tmpdir=$ESB_HOME\work\temp\esb
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XMLGrammarCachingConfiguration
-Desb.home="%ESB_HOME%"
-Desb.xml="%ESB_HOME%\webapp\WEB-INF\classes\conf\server.xml"
-Daxis2.xml="%ESB_HOME%\webapp\WEB-INF\classes\conf\axis2.xml"
-Daxis2.repo="%ESB_HOME%\repository" -Djava.endorsed.dirs=%ESB_ENDORSED%
%_XDEBUG% -cp %ESB_CLASS_PATH% org.wso2.esb.Main START %ESB_CMD_LINE_ARGS%
goto end
:end
Modified: trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.sh
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.sh
(original)
+++ trunk/esb/java/modules/distribution/src/main/bin/wso2-esb.sh Thu Jan
3 09:16:59 2008
@@ -166,4 +166,4 @@
echo "Using JAVA_HOME: $JAVA_HOME"
echo "Using SYNAPSE_XML: $ESB_XML"
-$JAVA_HOME/bin/java $ESB_XML
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XMLGrammarCachingConfiguration
-Desb.home=$ESB_HOME
-Desb.xml=$ESB_HOME/webapp/WEB-INF/classes/conf/server.xml
-Daxis2.xml=$ESB_HOME/webapp/WEB-INF/classes/conf/axis2.xml
-Daxis2.repo=$ESB_HOME/repository -Djava.endorsed.dirs=$ESB_ENDORSED $XDEBUG
-classpath $ESB_CLASSPATH org.wso2.esb.Main START
\ No newline at end of file
+$JAVA_HOME/bin/java $ESB_XML -Djava.io.tmpdir=$ESB_HOME/work/temp/esb
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XMLGrammarCachingConfiguration
-Desb.home=$ESB_HOME
-Desb.xml=$ESB_HOME/webapp/WEB-INF/classes/conf/server.xml
-Daxis2.xml=$ESB_HOME/webapp/WEB-INF/classes/conf/axis2.xml
-Daxis2.repo=$ESB_HOME/repository -Djava.endorsed.dirs=$ESB_ENDORSED $XDEBUG
-classpath $ESB_CLASSPATH org.wso2.esb.Main START
\ No newline at end of file
Modified: trunk/esb/java/modules/distribution/src/main/conf/wrapper.conf
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/conf/wrapper.conf
(original)
+++ trunk/esb/java/modules/distribution/src/main/conf/wrapper.conf Thu Jan
3 09:16:59 2008
@@ -25,8 +25,8 @@
wrapper.java.classpath.8=tomcat/lib
wrapper.java.classpath.9=tomcat/lib/*.jar
wrapper.java.classpath.10=webapp/WEB-INF/classes/conf
-wrapper.java.classpath.11=webapp/WEB-INF/lib/extensions
-wrapper.java.classpath.12=webapp/WEB-INF/lib/extensions/*.jar
+wrapper.java.classpath.11=webapp/WEB-INF/lib/extensions
+wrapper.java.classpath.12=webapp/WEB-INF/lib/extensions/*.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=webapp/WEB-INF/lib
@@ -43,6 +43,7 @@
wrapper.java.additional.8=-Dmime-mappings.xml=webapp/WEB-INF/classes/conf/mime-mappings.xml
wrapper.java.additional.9=-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XMLGrammarCachingConfiguration
wrapper.java.additional.10=-Dlog4j.configuration=file:webapp/WEB-INF/classes/conf/log4j.properties
+wrapper.java.additional.11=-Djava.io.tmpdir=work/temp/esb
# Initial Java Heap Size (in MB) - compute according to system
#wrapper.java.initmemory=256
Modified: trunk/esb/java/modules/distribution/src/main/docs/ESB_Extending.html
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/docs/ESB_Extending.html
(original)
+++ trunk/esb/java/modules/distribution/src/main/docs/ESB_Extending.html
Thu Jan 3 09:16:59 2008
@@ -328,7 +328,7 @@
<p>Mediators may be Node mediators (i.e. these that can contain child
mediators) or Leaf mediators (mediators that does not hold any other child
-mediators). A Node mediator� must implement the
+mediators). A Node mediator� must implement the
org.apache.synapse.api.ListMediator interface listed below, or extend from
the org.apache.synapse.mediators.AbstractListMediator. </p>
@@ -429,7 +429,7 @@
implementations and the mediator class/es must be bundled in a JAR file
conforming to the J2SE Service Provider model (See the description for
Extensions below for more details and examples) and placed into the
-SYNAPSE_HOME/lib folder, so that the Synapse runtime could find and load the
+ESB_HOME/lib folder, so that the Synapse runtime could find and load the
definition. </p>
<p>Essentially this means that a custom JAR file must bundle your class
@@ -518,7 +518,7 @@
<p>Synapse loads available extensions from the runtime classpath using the <a
href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider">J2SE
Service Provider model</a>. This essentially iterates over the available JAR
-files, for� a META-INF/services directory within each file,� and looks for a
+files, for� a META-INF/services directory within each file,� and looks for a
text file with the name org.apache.synapse.config.xml.MediatorFactory which
contains a list of fully qualified classname that implement the above
interface, listing each class in a separate line. For example, the built-in
Modified: trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat
==============================================================================
--- trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat
(original)
+++ trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat Thu Jan
3 09:16:59 2008
@@ -111,7 +111,7 @@
echo Using AXIS2_HOME %AXIS2_HOME%
cd %AXIS2_HOME%
-"%_JAVACMD%" %_HTTPPORT% %_HTTPSPORT% %_SERVERNAME% %JAVA_OPTS% -cp
"%AXIS2_CLASS_PATH%" -Djava.endorsed.dirs="%AXIS2_ENDORSED%"
samples.util.SampleAxis2Server -repo "%AXIS2_HOME%\repository" -conf
"%AXIS2_HOME%\repository\conf\axis2.xml"
+"%_JAVACMD%" %_HTTPPORT% %_HTTPSPORT% %_SERVERNAME% %JAVA_OPTS% -cp
"%AXIS2_CLASS_PATH%" -Djava.io.tmpdir=$AXIS2_HOME\..\..\work\temp\sampleServer
-Djava.endorsed.dirs="%AXIS2_ENDORSED%" samples.util.SampleAxis2Server -repo
"%AXIS2_HOME%\repository" -conf "%AXIS2_HOME%\repository\conf\axis2.xml"
goto end
:end
Modified: trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh
==============================================================================
--- trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh
(original)
+++ trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh Thu Jan
3 09:16:59 2008
@@ -163,5 +163,5 @@
PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttps_port=9002 "
fi
-java $PROGRAM_PARAMS -Djava.endorsed.dirs=$AXIS2_ENDORSED -classpath
$AXIS2_CLASSPATH samples.util.SampleAxis2Server \
+java $PROGRAM_PARAMS -Djava.io.tmpdir=$AXIS2_HOME/../../work/temp/sampleServer
-Djava.endorsed.dirs=$AXIS2_ENDORSED -classpath $AXIS2_CLASSPATH
samples.util.SampleAxis2Server \
-repo $AXIS2_HOME/repository -conf $AXIS2_HOME/repository/conf/axis2.xml
\ No newline at end of file
Modified: trunk/esb/java/modules/samples/src/main/scripts/build.xml
==============================================================================
--- trunk/esb/java/modules/samples/src/main/scripts/build.xml (original)
+++ trunk/esb/java/modules/samples/src/main/scripts/build.xml Thu Jan 3
09:16:59 2008
@@ -104,6 +104,7 @@
<sysproperty key="itr" value="${itr}"/>
<sysproperty key="javax.net.ssl.trustStore"
value="./../../webapp/WEB-INF/classes/conf/trust.jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword"
value="password"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
@@ -121,6 +122,7 @@
classpathref="javac.classpath" fork="true">
<sysproperty key="addurl"
value="http://localhost:9000/soap/SimpleStockQuoteService"/>
<sysproperty key="trpurl" value="http://localhost:8080/"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
</java>
</target>
@@ -130,6 +132,7 @@
<sysproperty key="jms_dest" value="${jms_dest}"/>
<sysproperty key="jms_type" value="${jms_type}"/>
<sysproperty key="jms_payload" value="${jms_payload}"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
</java>
</target>
@@ -141,6 +144,7 @@
<sysproperty key="opt_file" value="${opt_file}"/>
<sysproperty key="javax.net.ssl.trustStore"
value="./../../webapp/WEB-INF/lib/trust.jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword"
value="password"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
@@ -159,6 +163,7 @@
<sysproperty key="addurl" value="${addurl}"/>
<sysproperty key="trpurl" value="${trpurl}"/>
<sysproperty key="prxurl" value="${prxurl}"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
</java>
</target>
@@ -172,6 +177,7 @@
<sysproperty key="msg" value="${msg}"/>
<sysproperty key="t" value="${t}"/>
<sysproperty key="session" value="${session}"/>
+ <sysproperty key="java.io.tmpdir"
value="./../../work/temp/sampleClient"/>
</java>
</target>
_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev