ODE-1060: Check for home system property
Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/30d959c8 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/30d959c8 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/30d959c8 Branch: refs/heads/ODE-1060 Commit: 30d959c8c1e689026142adba32f40881db6b61fd Parents: 18f6ec6 Author: sathwik <[email protected]> Authored: Fri Aug 12 20:38:04 2016 +0530 Committer: sathwik <[email protected]> Committed: Fri Aug 12 20:38:04 2016 +0530 ---------------------------------------------------------------------- .../main/java/org/apache/ode/tomee/Main.java | 37 +++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/30d959c8/tomee/src/main/java/org/apache/ode/tomee/Main.java ---------------------------------------------------------------------- diff --git a/tomee/src/main/java/org/apache/ode/tomee/Main.java b/tomee/src/main/java/org/apache/ode/tomee/Main.java index 852e23c..71e9eb7 100644 --- a/tomee/src/main/java/org/apache/ode/tomee/Main.java +++ b/tomee/src/main/java/org/apache/ode/tomee/Main.java @@ -24,25 +24,30 @@ import java.io.File; public class Main { public static void main(String[] args) { String home = System.getProperty("ode.server.home"); - final TomeeLauncher launcher = new TomeeLauncher(home); - try { - launcher.initialize(); - launcher.start(); - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - try { - launcher.stop(); - System.out.println("Continer stopped"); - } catch (final Exception e) { - e.printStackTrace(); + if(home != null) { + final TomeeLauncher launcher = new TomeeLauncher(home); + try { + launcher.initialize(); + launcher.start(); + + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + launcher.stop(); + System.out.println("Continer stopped"); + } catch (final Exception e) { + e.printStackTrace(); + } } - } - }); + }); - launcher.deploy(new File(home,"webapps/ode"), "ode"); - } catch (Exception e) { - e.printStackTrace(); + launcher.deploy(new File(home,"webapps/ode"), "ode"); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + System.out.println("Cannot start the container. Kindly set system property ode.server.home"); } } } \ No newline at end of file
