Hi Paul,

since Karaf uses Pax Web/Jetty you'll need to switch to a Jetty like
configuration.
At my blog you'll find a description on how to do something like you want.
[1], [2]
But you'll need to switch to Karaf 3.0.1 for this to work as a newer
version of Pax Web is needed to support this.
A sample application can also be found at the samples of Pax Web. [3]

As quick outline, you'll need to define special connectors in the jetty.xml
that can be found in the etc folder of your Karaf
and need to reference this connector with a specialized manifest entry:
Web-Connectors

Btw. if you define multiple connectors and have no Web-Connectors manifest
entry the web application will be bound to all available.

regards, Achim


[1] -
http://notizblog.nierbeck.de/2013/01/bind-certain-web-applications-to-specific-httpconnectors/
[2] -
http://notizblog.nierbeck.de/2013/05/bind-certain-web-applications-to-specific-httpconnectors-ii/
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/pax-exam-3.0.x/samples/whiteboard-extended/src/main/java/org/ops4j/pax/web/extender/samples/whiteboard/internal/Activator.java


2014-08-19 11:30 GMT+02:00 Paul Spencer <[email protected]>:

> Karaf 2.3.5+
> I have a web based application running on Tomcat that I would like to
> migrate to Karaf.  There are three instances of the application installed
> on one Tomcat server with each instance sharing a common war but configured
> in its own context.  As shown below, The <Parameter> and <Envronment> tags
> in the context are used to customize each instance of the application. How
> do I migrate the application with three instance to one Karaf server?
>
> ** Instance 1:
> URL:  http://example.com/app_instance_1
> Context File:  ${CATALINA_BASE}/conf/Catalina/localhost/app_instance_1.xml
>  <Context path=“/app_instance_1” docbase=“{catalina.base}/wars/app.war”>
>   <Parameter    name=“config.param” value=“instance_1” override=“false”/>
>   <Environment  name=“config.name”  value=“Instance 1” override=“false”
> type=“java.lang.String”/>
>  </Context>
>
> ** Instance 1:
> URL:  http://example.com/app_instance_2
> Context File:  ${CATALINA_BASE}/conf/Catalina/localhost/app_instance_2.xml
>  <Context path=“/app_instance_2” docbase=“{catalina.base}/wars/app.war”>
>   <Parameter    name=“config.param” value=“instance_2” override=“false”/>
>   <Environment  name=“config.name”  value=“Instance 2” override=“false”
> type=“java.lang.String”/>
>  </Context>
>
> ** Instance 3:
> URL:  http://example.com/app_instance_3
> Context File:  ${CATALINA_BASE}/conf/Catalina/localhost/app_instance_3.xml
>  <Context path=“/app_instance_3” docbase=“{catalina.base}/wars/app.war”>
>   <Parameter    name=“config.param” value=“instance_3” override=“false”/>
>   <Environment  name=“config.name”  value=“Instance 3” override=“false”
> type=“java.lang.String”/>
>  </Context>
>
> Paul Spencer
>
>
>
>
>
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Reply via email to