FR [2977050] - Read ADEMPIERE_HOME from web.xml

https://sourceforge.net/tracker/?func=detail&aid=2977050&group_id=176962&atid=955896
This commit is contained in:
trifonnt 2010-03-26 14:18:53 +00:00
parent 9e0fb85df1
commit cbc9d926b2
2 changed files with 19 additions and 2 deletions

View File

@ -41,6 +41,8 @@ import javax.jnlp.FileContents;
import javax.jnlp.PersistenceService;
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.adempiere.plaf.AdempiereLookAndFeel;
import org.adempiere.plaf.AdempiereThemeInnova;
@ -748,7 +750,17 @@ public final class Ini implements Serializable
String env = System.getProperty (ENV_PREFIX + ADEMPIERE_HOME);
if (env == null)
env = System.getProperty (ADEMPIERE_HOME);
if (env == null) // Fallback
if (env == null) {
InitialContext context;
try {
context = new InitialContext();
env = (String) context.lookup("java:comp/env/"+ADEMPIERE_HOME);
} catch (NamingException e) {
log.fine( "Not found 'java:comp/env/"+ADEMPIERE_HOME+"' in Initial Context. " +e.getMessage());
}
}
if (env == null || "".equals(env) ) // Fallback
env = File.separator + "Adempiere";
return env;
} // getAdempiereHome

View File

@ -158,6 +158,11 @@
</mime-mapping>
<welcome-file-list>
<welcome-file>index.zul</welcome-file>
</welcome-file-list>
<!--env-entry>
<env-entry-name>ADEMPIERE_HOME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>/opt/adempiere/</env-entry-value>
</env-entry-->
</web-app>