I am running jetty(9.2.1) as a service for deploying two applications. These are the steps that I followed
Started the jetty service
I have two applications to deploy in the same jetty instance. I added two war files in jetty home directory. Created two xml files in 'webapps' folder to set the contextpath and war. The applications got launched in the context path.
But I have two wars to deploy and both these applications need different value for the system property 'appConfigPath'. How can I achieve this?
Solutions tried out
If it was only one application and it is not run as a service, I can run it like this - java -Dappconfig=service.properties -jar start.jar
If there was only one application and it is run as a service, I could specify the system property in start.ini.
Referred this - Jetty - set system property and I tried to add setProperty in the xml files that I created in webapps like below, but it didn't work.
jetty-app1.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/app1</Set>
<Set name="war">/opt/jetty/app1.war</Set>
<Call class="java.lang.System" name="setProperty">
<Arg>appConfigPath</Arg>
<Arg>opt/jetty/service1.properties</Arg>
</Call>
</Configure>
jetty-app2.xml
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/app2</Set>
<Set name="war">/opt/jetty/app2.war</Set>
<Call class="java.lang.System" name="setProperty">
<Arg>appConfigPath</Arg>
<Arg>opt/jetty/service2.properties</Arg>
</Call>
</Configure>