You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by mjelen <ma...@isb-ag.de> on 2016/03/23 12:53:48 UTC

Embedding Karaf in a WAR (Tomcat)

Dear Karaf developers und fellow users,

due to customer requirements, we have to deliver all our software as web
archives that are deployable on Tomcat. I'm hoping for this requirement to
change in the future and I've been reasoning with our customer for over a
year now about it, but at the moment they won't budge. 

We're currently developing a couple of web applications using Karaf and for
production deployment, we have built a reasonably generic Felix WAR that
starts the OSGi Container and includes the Felix File Install to read and
start our application bundles from a custom directory. This approach has
been working within Tomcat for over a year, but it has several drawbacks.
Those that I'm aware of are:
  - The development and production environment are different from each
other, introducing a new bug source (I can live with the necessary
difference between embedded Jetty and bridged Tomcat, but I don't want more
than that).
  - In production, we lose a lot of Karaf's features (such as the console,
"feature"s, wrappers, KARs) and have to fall back on the basic File Install
(no start levels etc.) and have to package the applications differently for
development/production.
  - We have to maintain our custom Felix WAR distribution.
  
To solve these problems, I would ideally have a generic Karaf launcher
packaged as a WAR with the path to a Karaf home directory a parameter. That
way I could simply decide whether Karaf gets started by the shell script or
from my web application WAR. However, I can see several hurdles on the way
and would be interested to hear if anyone has successfully done this before. 

Things I'm unsure of right now:
  - The default Karaf launcher (.bat/.sh scripts) uses the "endorsed
libraries" mechanism of the JRE to override even classes like
java.lang.Exception. Even if that works with current Tomcat versions (I
haven't tried that yet), it seems fragile for the future in the embedded
scenario and I'm not happy about changing Tomcat's libraries to that extent.
  - Will I have to include any/many libraries in Tomcat's classloader (e.g.
in my WAR's WEB-INF/lib and modified framework.properties)? I already had to
do that for my Felix WAR with Geronimo JTA-spec and it works fine at the
moment, but again it makes me nervous regarding future enhancements.
  
Any help will be appreciated, whether you have a few pointers for a
solution, some code to share or even a horror story about how it can't be
done :-).

Kind regards

--
Martin Jelen
ISB AG



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Embedding Karaf in a WAR (Tomcat)

Posted by mjelen <ma...@isb-ag.de>.
Hi JB, 

thank you for the pointer! It was your comment on the mailing list regarding
the "dual polymorphic container" phrase that gave me the idea to ask here in
the first place.

Regards,
Martin



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046033.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Embedding Karaf in a WAR (Tomcat)

Posted by Nick Baker <nb...@pentaho.com>.
Our current approach is also a "migration" strategy. This is an unfortunate reality for those with large existing code-bases.

We anticipate "flipping the architecture" soon which will put Everything in Karaf. The non-OSGI libraries will be collected together as a "legacy" bundle. At that point we'll be leveraging PAX-Web instead of deploying inside an existing servlet container.

-Nick

From: Serge Huber <sh...@jahia.com>>
Reply-To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Date: Wednesday, March 30, 2016 at 3:21 AM
To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Subject: Re: Embedding Karaf in a WAR (Tomcat)

Hi Achim and Martin,

Actually my own company is going through this transition, but for the moment our main application (CMS) still has to be deployed within web containers such as Tomcat or WebSphere. So using an Http Bridge is a hard requirement for the moment.

As soon as we can drop this requirement we will but in the meantime we want a bridge that can be as feature-ful as possible. Currently we use the Felix Http Bridge in production but I’m really hoping we can switch to the new Pax Web Bridge soon, as it is a *lot* better.

Yes it is indeed strange to have this bridge because you can potentially have a web application within a web application (but at the same time this is kinda cool, ok I’m a nerd :)). Anyway, I believe it can be an interesting migration path for a lot of existing web applications out there.

Let’s get everyone on Karaf & Pax Web :) Who needs Node.js ? :)

cheers,
  Serge…


On 29 mars 2016, at 17:47, Achim Nierbeck <bc...@googlemail.com>> wrote:

Hi Martin,

I'm still in favor of using plain Karaf with Web-Container instead of the opposite, but I can see the benefits for easier transition of doing the bridge thing. Thanks to the Help of Serge, we now have a special branch [1], cause the bridge is still work-in-progress [2].

regards, Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/PAXWEB-606-Servlet-Bridge
[2] - https://ops4j1.jira.com/browse/PAXWEB-606

2016-03-29 16:45 GMT+02:00 mjelen <ma...@isb-ag.de>>:
Hi Serge,

thank you for your reply! I'll look into the PAX Web Bridge, I guess the
right place to talk about it is the OPS4J Google Group.

I admit I haven't thought of looking at PAX Web for my purpose because I'd
seen it as having the opposite purpose of what I'm looking for - that is,
starting an embedded Tomcat (or Jetty or Undertow) rather than running
inside a Tomcat instance. Especially since I've read several comments from
Achim dissuading people from embedding Karaf in Tomcat (which I can
understand, I'm not happy about it myself and I'll keep trying to get rid of
this requirement).

Regards
Martin



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046031.html
Sent from the Karaf - User mailing list archive at Nabble.com<http://nabble.com>.



--

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/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master



Re: Embedding Karaf in a WAR (Tomcat)

Posted by Serge Huber <sh...@jahia.com>.
Hi Achim and Martin, 

Actually my own company is going through this transition, but for the moment our main application (CMS) still has to be deployed within web containers such as Tomcat or WebSphere. So using an Http Bridge is a hard requirement for the moment. 

As soon as we can drop this requirement we will but in the meantime we want a bridge that can be as feature-ful as possible. Currently we use the Felix Http Bridge in production but I’m really hoping we can switch to the new Pax Web Bridge soon, as it is a *lot* better.

Yes it is indeed strange to have this bridge because you can potentially have a web application within a web application (but at the same time this is kinda cool, ok I’m a nerd :)). Anyway, I believe it can be an interesting migration path for a lot of existing web applications out there. 

Let’s get everyone on Karaf & Pax Web :) Who needs Node.js ? :) 

cheers,
  Serge… 


> On 29 mars 2016, at 17:47, Achim Nierbeck <bc...@googlemail.com> wrote:
> 
> Hi Martin, 
> 
> I'm still in favor of using plain Karaf with Web-Container instead of the opposite, but I can see the benefits for easier transition of doing the bridge thing. Thanks to the Help of Serge, we now have a special branch [1], cause the bridge is still work-in-progress [2].
> 
> regards, Achim 
> 
> [1] - https://github.com/ops4j/org.ops4j.pax.web/tree/PAXWEB-606-Servlet-Bridge <https://github.com/ops4j/org.ops4j.pax.web/tree/PAXWEB-606-Servlet-Bridge>
> [2] - https://ops4j1.jira.com/browse/PAXWEB-606 <https://ops4j1.jira.com/browse/PAXWEB-606> 
> 
> 2016-03-29 16:45 GMT+02:00 mjelen <martin.jelen@isb-ag.de <ma...@isb-ag.de>>:
> Hi Serge,
> 
> thank you for your reply! I'll look into the PAX Web Bridge, I guess the
> right place to talk about it is the OPS4J Google Group.
> 
> I admit I haven't thought of looking at PAX Web for my purpose because I'd
> seen it as having the opposite purpose of what I'm looking for - that is,
> starting an embedded Tomcat (or Jetty or Undertow) rather than running
> inside a Tomcat instance. Especially since I've read several comments from
> Achim dissuading people from embedding Karaf in Tomcat (which I can
> understand, I'm not happy about it myself and I'll keep trying to get rid of
> this requirement).
> 
> Regards
> Martin
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046031.html <http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046031.html>
> Sent from the Karaf - User mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> 
> Apache Member
> Apache Karaf <http://karaf.apache.org/ <http://karaf.apache.org/>> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/ <http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer & Project Lead
> blog <http://notizblog.nierbeck.de/ <http://notizblog.nierbeck.de/>>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS <http://bit.ly/1ps9rkS>>
> 
> Software Architect / Project Manager / Scrum Master 
> 


Re: Embedding Karaf in a WAR (Tomcat)

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Martin,

I'm still in favor of using plain Karaf with Web-Container instead of the
opposite, but I can see the benefits for easier transition of doing the
bridge thing. Thanks to the Help of Serge, we now have a special branch
[1], cause the bridge is still work-in-progress [2].

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/tree/PAXWEB-606-Servlet-Bridge
[2] - https://ops4j1.jira.com/browse/PAXWEB-606

2016-03-29 16:45 GMT+02:00 mjelen <ma...@isb-ag.de>:

> Hi Serge,
>
> thank you for your reply! I'll look into the PAX Web Bridge, I guess the
> right place to talk about it is the OPS4J Google Group.
>
> I admit I haven't thought of looking at PAX Web for my purpose because I'd
> seen it as having the opposite purpose of what I'm looking for - that is,
> starting an embedded Tomcat (or Jetty or Undertow) rather than running
> inside a Tomcat instance. Especially since I've read several comments from
> Achim dissuading people from embedding Karaf in Tomcat (which I can
> understand, I'm not happy about it myself and I'll keep trying to get rid
> of
> this requirement).
>
> Regards
> Martin
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046031.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

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/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Embedding Karaf in a WAR (Tomcat)

Posted by mjelen <ma...@isb-ag.de>.
Hi Serge,

thank you for your reply! I'll look into the PAX Web Bridge, I guess the
right place to talk about it is the OPS4J Google Group. 

I admit I haven't thought of looking at PAX Web for my purpose because I'd
seen it as having the opposite purpose of what I'm looking for - that is,
starting an embedded Tomcat (or Jetty or Undertow) rather than running
inside a Tomcat instance. Especially since I've read several comments from
Achim dissuading people from embedding Karaf in Tomcat (which I can
understand, I'm not happy about it myself and I'll keep trying to get rid of
this requirement).

Regards
Martin



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046031.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Embedding Karaf in a WAR (Tomcat)

Posted by Serge Huber <sh...@jahia.com>.
Yes I’ve been working on a PAX Web Bridge that is much more powerful than the Http Bridge but is not yet fully implemented. 

This way you could bootstrap a Karaf container inside a web application and then deploy servlet, JSP, tag libraries and filters and serve complex web requests from OSGi bundles deployed inside the embedded Karaf container.

The PAX Web Bridge ongoing work is here : https://github.com/ops4j/org.ops4j.pax.web/tree/PAXWEB-606-Servlet-Bridge

Btw I need help to work on the bridge, because I’m currently lacking time to work on it.

cheers,  
  Serge… 

> On 23 mars 2016, at 13:21, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Hi,
> 
> I worked with Serge (from Jahia) to embed Karaf in tomcat as a war.
> 
> It's available there:
> 
> https://github.com/apache/karaf/tree/master/demos/web
> 
> You will see that this war use a WebAppListener that starts Karaf in Tomcat.
> 
> Regards
> JB
> 
> On 03/23/2016 12:53 PM, mjelen wrote:
>> Dear Karaf developers und fellow users,
>> 
>> due to customer requirements, we have to deliver all our software as web
>> archives that are deployable on Tomcat. I'm hoping for this requirement to
>> change in the future and I've been reasoning with our customer for over a
>> year now about it, but at the moment they won't budge.
>> 
>> We're currently developing a couple of web applications using Karaf and for
>> production deployment, we have built a reasonably generic Felix WAR that
>> starts the OSGi Container and includes the Felix File Install to read and
>> start our application bundles from a custom directory. This approach has
>> been working within Tomcat for over a year, but it has several drawbacks.
>> Those that I'm aware of are:
>>   - The development and production environment are different from each
>> other, introducing a new bug source (I can live with the necessary
>> difference between embedded Jetty and bridged Tomcat, but I don't want more
>> than that).
>>   - In production, we lose a lot of Karaf's features (such as the console,
>> "feature"s, wrappers, KARs) and have to fall back on the basic File Install
>> (no start levels etc.) and have to package the applications differently for
>> development/production.
>>   - We have to maintain our custom Felix WAR distribution.
>> 
>> To solve these problems, I would ideally have a generic Karaf launcher
>> packaged as a WAR with the path to a Karaf home directory a parameter. That
>> way I could simply decide whether Karaf gets started by the shell script or
>> from my web application WAR. However, I can see several hurdles on the way
>> and would be interested to hear if anyone has successfully done this before.
>> 
>> Things I'm unsure of right now:
>>   - The default Karaf launcher (.bat/.sh scripts) uses the "endorsed
>> libraries" mechanism of the JRE to override even classes like
>> java.lang.Exception. Even if that works with current Tomcat versions (I
>> haven't tried that yet), it seems fragile for the future in the embedded
>> scenario and I'm not happy about changing Tomcat's libraries to that extent.
>>   - Will I have to include any/many libraries in Tomcat's classloader (e.g.
>> in my WAR's WEB-INF/lib and modified framework.properties)? I already had to
>> do that for my Felix WAR with Geronimo JTA-spec and it works fine at the
>> moment, but again it makes me nervous regarding future enhancements.
>> 
>> Any help will be appreciated, whether you have a few pointers for a
>> solution, some code to share or even a horror story about how it can't be
>> done :-).
>> 
>> Kind regards
>> 
>> --
>> Martin Jelen
>> ISB AG
>> 
>> 
>> 
>> --
>> View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: Embedding Karaf in a WAR (Tomcat)

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I worked with Serge (from Jahia) to embed Karaf in tomcat as a war.

It's available there:

https://github.com/apache/karaf/tree/master/demos/web

You will see that this war use a WebAppListener that starts Karaf in Tomcat.

Regards
JB

On 03/23/2016 12:53 PM, mjelen wrote:
> Dear Karaf developers und fellow users,
>
> due to customer requirements, we have to deliver all our software as web
> archives that are deployable on Tomcat. I'm hoping for this requirement to
> change in the future and I've been reasoning with our customer for over a
> year now about it, but at the moment they won't budge.
>
> We're currently developing a couple of web applications using Karaf and for
> production deployment, we have built a reasonably generic Felix WAR that
> starts the OSGi Container and includes the Felix File Install to read and
> start our application bundles from a custom directory. This approach has
> been working within Tomcat for over a year, but it has several drawbacks.
> Those that I'm aware of are:
>    - The development and production environment are different from each
> other, introducing a new bug source (I can live with the necessary
> difference between embedded Jetty and bridged Tomcat, but I don't want more
> than that).
>    - In production, we lose a lot of Karaf's features (such as the console,
> "feature"s, wrappers, KARs) and have to fall back on the basic File Install
> (no start levels etc.) and have to package the applications differently for
> development/production.
>    - We have to maintain our custom Felix WAR distribution.
>
> To solve these problems, I would ideally have a generic Karaf launcher
> packaged as a WAR with the path to a Karaf home directory a parameter. That
> way I could simply decide whether Karaf gets started by the shell script or
> from my web application WAR. However, I can see several hurdles on the way
> and would be interested to hear if anyone has successfully done this before.
>
> Things I'm unsure of right now:
>    - The default Karaf launcher (.bat/.sh scripts) uses the "endorsed
> libraries" mechanism of the JRE to override even classes like
> java.lang.Exception. Even if that works with current Tomcat versions (I
> haven't tried that yet), it seems fragile for the future in the embedded
> scenario and I'm not happy about changing Tomcat's libraries to that extent.
>    - Will I have to include any/many libraries in Tomcat's classloader (e.g.
> in my WAR's WEB-INF/lib and modified framework.properties)? I already had to
> do that for my Felix WAR with Geronimo JTA-spec and it works fine at the
> moment, but again it makes me nervous regarding future enhancements.
>
> Any help will be appreciated, whether you have a few pointers for a
> solution, some code to share or even a horror story about how it can't be
> done :-).
>
> Kind regards
>
> --
> Martin Jelen
> ISB AG
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Embedding Karaf in a WAR (Tomcat)

Posted by mjelen <ma...@isb-ag.de>.
Hi Nick, hi Tom,

thank you for your answers, this looks like much more complete solution than
I'd have had time to implement myself. 

We'll have a team starting work on a new webapp in a couple of weeks and
your solution gives me confidence to point them this way after I take a
closer look at it. Nick, I'll try to keep you posted on whether we run into
any challenges using your approach if you're interested.

Regards
Martin



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931p4046032.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Embedding Karaf in a WAR (Tomcat)

Posted by Nick Baker <nb...@pentaho.com>.
We boot Karaf on the Servlet Context Listener chain. Regular Karaf Main class with a lot of special code to handle write access issues to the installation directory. We also support multiple instances from the same install so the caches are segmented and port conflicts resolved prior to startup (this is being refactored now):
https://github.com/pentaho/pentaho-platform/blob/master/extensions/src/org/pentaho/platform/osgi/KarafBoot.java

Many of the classes are still in the WAR so we have added support for package wild-cards to system.packages.extra just make make it maintainable. Those wildcards are expanded out on boot resolving all packages available in the parent classloader ( war/WEB-INF/lib, JBoss module support as well):
https://github.com/pentaho/pentaho-platform/blob/master/extensions/src/org/pentaho/platform/osgi/SystemPackageExtrapolator.java

We bridge the HTTP service in OSGI out to the Servlet Container using the Felix HTTP Bridge Proxy Servlet:
http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html

I know JBoss and Apache Sling both do something very similar if you're looking for an out of the box solution

-Nick

From: Tom Barber <to...@meteorite.bi>>
Reply-To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Date: Wednesday, March 23, 2016 at 7:58 AM
To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Subject: Re: Embedding Karaf in a WAR (Tomcat)

Hi Martin

I'm not sure quite how they bootstrap it, but Pentaho BI Server 6.x runs Tomcat & Karaf as a single service.

Tom

On Wed, Mar 23, 2016 at 11:53 AM, mjelen <ma...@isb-ag.de>> wrote:
Dear Karaf developers und fellow users,

due to customer requirements, we have to deliver all our software as web
archives that are deployable on Tomcat. I'm hoping for this requirement to
change in the future and I've been reasoning with our customer for over a
year now about it, but at the moment they won't budge.

We're currently developing a couple of web applications using Karaf and for
production deployment, we have built a reasonably generic Felix WAR that
starts the OSGi Container and includes the Felix File Install to read and
start our application bundles from a custom directory. This approach has
been working within Tomcat for over a year, but it has several drawbacks.
Those that I'm aware of are:
  - The development and production environment are different from each
other, introducing a new bug source (I can live with the necessary
difference between embedded Jetty and bridged Tomcat, but I don't want more
than that).
  - In production, we lose a lot of Karaf's features (such as the console,
"feature"s, wrappers, KARs) and have to fall back on the basic File Install
(no start levels etc.) and have to package the applications differently for
development/production.
  - We have to maintain our custom Felix WAR distribution.

To solve these problems, I would ideally have a generic Karaf launcher
packaged as a WAR with the path to a Karaf home directory a parameter. That
way I could simply decide whether Karaf gets started by the shell script or
from my web application WAR. However, I can see several hurdles on the way
and would be interested to hear if anyone has successfully done this before.

Things I'm unsure of right now:
  - The default Karaf launcher (.bat/.sh scripts) uses the "endorsed
libraries" mechanism of the JRE to override even classes like
java.lang.Exception. Even if that works with current Tomcat versions (I
haven't tried that yet), it seems fragile for the future in the embedded
scenario and I'm not happy about changing Tomcat's libraries to that extent.
  - Will I have to include any/many libraries in Tomcat's classloader (e.g.
in my WAR's WEB-INF/lib and modified framework.properties)? I already had to
do that for my Felix WAR with Geronimo JTA-spec and it works fine at the
moment, but again it makes me nervous regarding future enhancements.

Any help will be appreciated, whether you have a few pointers for a
solution, some code to share or even a horror story about how it can't be
done :-).

Kind regards

--
Martin Jelen
ISB AG



--
View this message in context: http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Embedding Karaf in a WAR (Tomcat)

Posted by Tom Barber <to...@meteorite.bi>.
Hi Martin

I'm not sure quite how they bootstrap it, but Pentaho BI Server 6.x runs
Tomcat & Karaf as a single service.

Tom

On Wed, Mar 23, 2016 at 11:53 AM, mjelen <ma...@isb-ag.de> wrote:

> Dear Karaf developers und fellow users,
>
> due to customer requirements, we have to deliver all our software as web
> archives that are deployable on Tomcat. I'm hoping for this requirement to
> change in the future and I've been reasoning with our customer for over a
> year now about it, but at the moment they won't budge.
>
> We're currently developing a couple of web applications using Karaf and for
> production deployment, we have built a reasonably generic Felix WAR that
> starts the OSGi Container and includes the Felix File Install to read and
> start our application bundles from a custom directory. This approach has
> been working within Tomcat for over a year, but it has several drawbacks.
> Those that I'm aware of are:
>   - The development and production environment are different from each
> other, introducing a new bug source (I can live with the necessary
> difference between embedded Jetty and bridged Tomcat, but I don't want more
> than that).
>   - In production, we lose a lot of Karaf's features (such as the console,
> "feature"s, wrappers, KARs) and have to fall back on the basic File Install
> (no start levels etc.) and have to package the applications differently for
> development/production.
>   - We have to maintain our custom Felix WAR distribution.
>
> To solve these problems, I would ideally have a generic Karaf launcher
> packaged as a WAR with the path to a Karaf home directory a parameter. That
> way I could simply decide whether Karaf gets started by the shell script or
> from my web application WAR. However, I can see several hurdles on the way
> and would be interested to hear if anyone has successfully done this
> before.
>
> Things I'm unsure of right now:
>   - The default Karaf launcher (.bat/.sh scripts) uses the "endorsed
> libraries" mechanism of the JRE to override even classes like
> java.lang.Exception. Even if that works with current Tomcat versions (I
> haven't tried that yet), it seems fragile for the future in the embedded
> scenario and I'm not happy about changing Tomcat's libraries to that
> extent.
>   - Will I have to include any/many libraries in Tomcat's classloader (e.g.
> in my WAR's WEB-INF/lib and modified framework.properties)? I already had
> to
> do that for my Felix WAR with Geronimo JTA-spec and it works fine at the
> moment, but again it makes me nervous regarding future enhancements.
>
> Any help will be appreciated, whether you have a few pointers for a
> solution, some code to share or even a horror story about how it can't be
> done :-).
>
> Kind regards
>
> --
> Martin Jelen
> ISB AG
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Embedding-Karaf-in-a-WAR-Tomcat-tp4045931.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>