You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Vincent Zurczak <vi...@linagora.com> on 2015/02/06 18:00:43 UTC

Use Jetty 9.x with Karaf 3.x

Hi,

I would like to implement a web socket in an OSGi application that runs 
in Karaf.
I know Jetty 9.x comes with Pax-Web 4.x, which is itself used in Karaf 4.x.

However, I have a custom Karaf distribution based on 3.x (3.0.2 now).
And I wanted to use Pax-Web 4.1 with Karaf 3.x. Removing Pax-Web 3.x was 
easy. I then stopped Karaf and removed the *etc/jetty.xml* file, to 
prevent NoClassDefFound exceptions. When I restart Karaf, my former web 
applications work correctly. But I have errors with package imports in 
...*karaf.http.core* and in the web console. This is related to the 
version of the *javax.servlet* package.

To be honest, I do not know what to do, hence this message.

1. One solution could be to switch to Karaf 4.x, but our project aims at 
being as stable as possible
Contributing and testing Karaf 4.x would not be a problem, but relying 
on a development version for months is not the best option.

2. Another solution could be to implement web sockets with a different 
Java framework (but still deployed in Karaf).
Since Jetty was already deployed in our custom distribution, it made 
sense to reuse it. But if we cannot, we will have to stick with another 
server. Or maybe is there another way of dealing with web sockets in Karaf?

3. An alternative could also be to support Pax-Web 4.x with Karaf 3.x.
That would mean having the "standard" feature with Pax-Web 3.x and a 
"standard-4.x" with Pax-Web 4.x. If the name is not well-chosen, the 
idea is here. I do not know if it seems feasible with the package 
imports versions (there may be incompatible constraints). But if it is, 
I could try to help on this.

Otherwise, any suggestion is welcome.
And last but not least, I mentioned custom distributions. If there was 
an automatic solution to deploy Pax-Web 4.x in Karaf 3.x, that would be 
great. I saw [0] on the bug tracker, it could be the solution. The 3rd 
option (above) would also fit.

Thanks for reading me.

Cheers,

                 Vincent.


[ 0 ] : https://issues.apache.org/jira/browse/KARAF-3259


-- 
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn 
<http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID 
<callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Use Jetty 9.x with Karaf 3.x

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

short answer: Pax Web 4.x doesn't work in Karaf 3.

Why not upgrading to Karaf 4 ?

Regards
JB

On 02/06/2015 06:00 PM, Vincent Zurczak wrote:
> Hi,
>
> I would like to implement a web socket in an OSGi application that runs
> in Karaf.
> I know Jetty 9.x comes with Pax-Web 4.x, which is itself used in Karaf 4.x.
>
> However, I have a custom Karaf distribution based on 3.x (3.0.2 now).
> And I wanted to use Pax-Web 4.1 with Karaf 3.x. Removing Pax-Web 3.x was
> easy. I then stopped Karaf and removed the *etc/jetty.xml* file, to
> prevent NoClassDefFound exceptions. When I restart Karaf, my former web
> applications work correctly. But I have errors with package imports in
> ...*karaf.http.core* and in the web console. This is related to the
> version of the *javax.servlet* package.
>
> To be honest, I do not know what to do, hence this message.
>
> 1. One solution could be to switch to Karaf 4.x, but our project aims at
> being as stable as possible
> Contributing and testing Karaf 4.x would not be a problem, but relying
> on a development version for months is not the best option.
>
> 2. Another solution could be to implement web sockets with a different
> Java framework (but still deployed in Karaf).
> Since Jetty was already deployed in our custom distribution, it made
> sense to reuse it. But if we cannot, we will have to stick with another
> server. Or maybe is there another way of dealing with web sockets in Karaf?
>
> 3. An alternative could also be to support Pax-Web 4.x with Karaf 3.x.
> That would mean having the "standard" feature with Pax-Web 3.x and a
> "standard-4.x" with Pax-Web 4.x. If the name is not well-chosen, the
> idea is here. I do not know if it seems feasible with the package
> imports versions (there may be incompatible constraints). But if it is,
> I could try to help on this.
>
> Otherwise, any suggestion is welcome.
> And last but not least, I mentioned custom distributions. If there was
> an automatic solution to deploy Pax-Web 4.x in Karaf 3.x, that would be
> great. I saw [0] on the bug tracker, it could be the solution. The 3rd
> option (above) would also fit.
>
> Thanks for reading me.
>
> Cheers,
>
>                  Vincent.
>
>
> [ 0 ] : https://issues.apache.org/jira/browse/KARAF-3259
>
>
> --
> Vincent Zurczak
> Linagora: www.linagora.com <http://www.linagora.com/>
>
> Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn
> <http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID
> <callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

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

Re: Use Jetty 9.x with Karaf 3.x

Posted by Vincent Zurczak <vi...@linagora.com>.
Hi Richard,

I started small tests but I did not push them.
Given that we have a release planned by the end of March, we delayed all 
that was related to web stuff (including web sockets and switching to 
Karaf 4) to the next iteration.

All I can say is that I encountered some problems when I replaced 3.0.3 
by 4.0.0-M2 in my POM.
 From memory, there was something with installing a feature which is 
only available in the local Maven repository.
And there were also troubles to install the *standard* feature in a 
custom distribution (with the Karaf Maven plugin).

I started to investigate, before pushing this task to later.
I will be back on it at the beginning of April.

Regards,

                 Vincent.


Le 12/03/2015 10:50, Richard Hierlmeier a écrit :
>
> Hi Vincent,
>
> I need also websocket support in karaf. Did you upgrade to karaf 4? 
> What is your experience?
>
>
> Thank you
>
>   Richard

-- 
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn 
<http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID 
<callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Use Jetty 9.x with Karaf 3.x

Posted by Richard Hierlmeier <rh...@googlemail.com>.
Hi Vincent,

I need also websocket support in karaf. Did you upgrade to karaf 4? What 
is your experience?


Thank you

   Richard


Am 09.02.2015 um 10:21 schrieb Vincent Zurczak:
> Hi,
>
> My answers below.
>
> Le 06/02/2015 19:25, Achim Nierbeck a écrit :
>>
>>     3. An alternative could also be to support Pax-Web 4.x with Karaf 3.x.
>>     That would mean having the "standard" feature with Pax-Web 3.x and
>>     a "standard-4.x" with Pax-Web 4.x. If the name is not well-chosen,
>>     the idea is here. I do not know if it seems feasible with the
>>     package imports versions (there may be incompatible constraints).
>>     But if it is, I could try to help on this.
>>
>>
>> nope, just to much work to maintain. And since this is done mostly on
>> private basis ... just NO. :-)d.
>
> No problem, I understand.
>
>
>> Le 06/02/2015 18:37, Jean-Baptiste Onofré a écrit :
>>> short answer: Pax Web 4.x doesn't work in Karaf 3.
>>>
>>> Why not upgrading to Karaf 4 ?
>
> After thinking about it, I will wait for M2 and try it. :)
>
> Thanks,
>
>                 Vincent.
>
> --
> Vincent Zurczak
> Linagora: www.linagora.com <http://www.linagora.com/>
>
> Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn
> <http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID
> <callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Use Jetty 9.x with Karaf 3.x

Posted by Vincent Zurczak <vi...@linagora.com>.
Hi,

My answers below.

Le 06/02/2015 19:25, Achim Nierbeck a écrit :
>
>     3. An alternative could also be to support Pax-Web 4.x with Karaf 3.x.
>     That would mean having the "standard" feature with Pax-Web 3.x and
>     a "standard-4.x" with Pax-Web 4.x. If the name is not well-chosen,
>     the idea is here. I do not know if it seems feasible with the
>     package imports versions (there may be incompatible constraints).
>     But if it is, I could try to help on this.
>
>
> nope, just to much work to maintain. And since this is done mostly on 
> private basis ... just NO. :-)d.

No problem, I understand.


> Le 06/02/2015 18:37, Jean-Baptiste Onofré a écrit :
>> short answer: Pax Web 4.x doesn't work in Karaf 3.
>>
>> Why not upgrading to Karaf 4 ? 

After thinking about it, I will wait for M2 and try it. :)

Thanks,

                Vincent.

-- 
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn 
<http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID 
<callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Use Jetty 9.x with Karaf 3.x

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

let me answer inline:

2015-02-06 18:00 GMT+01:00 Vincent Zurczak <vi...@linagora.com>:

>  Hi,
>
> I would like to implement a web socket in an OSGi application that runs in
> Karaf.
> I know Jetty 9.x comes with Pax-Web 4.x, which is itself used in Karaf 4.x.
>
> However, I have a custom Karaf distribution based on 3.x (3.0.2 now).
> And I wanted to use Pax-Web 4.1 with Karaf 3.x. Removing Pax-Web 3.x was
> easy. I then stopped Karaf and removed the *etc/jetty.xml* file, to
> prevent NoClassDefFound exceptions. When I restart Karaf, my former web
> applications work correctly. But I have errors with package imports in ...
> *karaf.http.core* and in the web console. This is related to the version
> of the *javax.servlet* package.
>

it might work, but you can't use the web feature etc. as those will also
try to install the web and http shell extensions.
Another drawback, since you can't use those features camel etc. won't be
able to resolve cause those are relying on the http feature of karaf.



>
> To be honest, I do not know what to do, hence this message.
>
> 1. One solution could be to switch to Karaf 4.x, but our project aims at
> being as stable as possible
> Contributing and testing Karaf 4.x would not be a problem, but relying on
> a development version for months is not the best option.
>
>
a M2 will be on vote in the next coming weeks, so be prepared ;-)


> 2. Another solution could be to implement web sockets with a different
> Java framework (but still deployed in Karaf).
> Since Jetty was already deployed in our custom distribution, it made sense
> to reuse it. But if we cannot, we will have to stick with another server.
> Or maybe is there another way of dealing with web sockets in Karaf?
>
>
btw. it's already possible to use websockets in Jetty 8, it's just not the
JSR-356 as in Pax Web 4.1.
There is a sample available at the pax web samples section [1]


> 3. An alternative could also be to support Pax-Web 4.x with Karaf 3.x.
> That would mean having the "standard" feature with Pax-Web 3.x and a
> "standard-4.x" with Pax-Web 4.x. If the name is not well-chosen, the idea
> is here. I do not know if it seems feasible with the package imports
> versions (there may be incompatible constraints). But if it is, I could try
> to help on this.
>

nope, just to much work to maintain. And since this is done mostly on
private basis ... just NO. :-)


>
> Otherwise, any suggestion is welcome.
> And last but not least, I mentioned custom distributions. If there was an
> automatic solution to deploy Pax-Web 4.x in Karaf 3.x, that would be great.
> I saw [0] on the bug tracker, it could be the solution. The 3rd option
> (above) would also fit.
>
> Thanks for reading me.
>
> Cheers,
>
>                 Vincent.
>
>
> [ 0 ] : https://issues.apache.org/jira/browse/KARAF-3259
>
>
> --
> Vincent Zurczak
> Linagora: www.linagora.com
>
> [image: Twitter] <https://twitter.com/VincentZurczak> [image: Vincent
> Zurczak @ LinkedIn]
> <http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> [image: My Skype
> ID] <callto://vincent.zurczak> [image: My English blog]
> <http://vzurczak.wordpress.com>
>


regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/karaf-websocket

-- 

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