Don't start server if Adempiere.properties doesn't exists.

This commit is contained in:
Heng Sin Low 2010-11-04 03:54:17 +08:00
parent 470a5235a3
commit 3ce2d30129
1 changed files with 10 additions and 2 deletions

View File

@ -3,11 +3,13 @@
*/ */
package org.adempiere.server; package org.adempiere.server;
import java.io.File;
import java.util.Properties; import java.util.Properties;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.ServerContext; import org.adempiere.util.ServerContext;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.util.Ini;
import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.equinox.app.IApplicationContext;
@ -25,6 +27,12 @@ public class Application implements IApplication {
/** Initialise context for the current thread*/ /** Initialise context for the current thread*/
Properties serverContext = new Properties(); Properties serverContext = new Properties();
ServerContext.setCurrentInstance(serverContext); ServerContext.setCurrentInstance(serverContext);
String propertyFile = Ini.getFileName(false);
File file = new File(propertyFile);
if (!file.exists()) {
throw new IllegalStateException("Adempiere.properties file missing. Path="+file.getAbsolutePath());
}
if (!Adempiere.isStarted()) if (!Adempiere.isStarted())
{ {
boolean started = Adempiere.startup(false); boolean started = Adempiere.startup(false);