Reference:
http://code.google.com/p/parsecsv2sql/source/browse/trunk/Csv2Sql/src/org/gonevertical/dts/lib/pooling/SetupInitialContext.java
How I set it up:
public DatabaseConnection(boolean pool) {
File executionlocation = null;
try {
executionlocation = new File(DatabaseConnection.class.getProtectionDomain().getCodeSource().getLocation().toURI());
} catch (URISyntaxException e) {
e.printStackTrace();
}
String execPath = executionlocation.getParent();
execPath = StringUtil.getValue("(.*?)/war", execPath);
String path = execPath + "/war/META-INF/context.xml";
String contextXmlPath = path;
String tmpPath = "/home/branflake2267/tmp";
// make my own context
SetupInitialContext ic = new SetupInitialContext(tmpPath);
ic.setContextXmlFileLocation(contextXmlPath);
ic.run();
context = ic.getInitialContext();
}