embedded karaf - hotdeploy & console

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

embedded karaf - hotdeploy & console

Tomasz Kaczanowski
Hi All,

trying to run Karaf embedded within web application deployed to Jetty or
JBoss. Yes, I know this is suboptimal, but well, I need it have it
running inside some web container.

So I managed to run Karaf by calling Main() within some web listener
(invoked from web.xml), but:

- hot deploy does not seem to work: OSGi bundles copied into
WEB-INF/karaf/deploy are ignored (nothing happens)
- I can't connect to local or remote console - even though I put system
properties (System.setProperty("karaf.startLocalConsole",
"true");System.setProperty("karaf.startRemoteShell", "true");) which
should (AFAIK) start the console

The question is if I'm hitting the limits of what embedded Karaf can do,
or (most probably) I do it wrong. Is there any complete example of
having fully-fledged Karaf running in embedded mode?

--
Tomasz Kaczanowski
Senior Software Engineer

Software Mind SA| Where Quality Meets the Future
ul. Bociana 22a
31-231 Krakow
Poland
Tel. +48 12 252 34 00
Fax: +48 12 252 34 01
[hidden email]
skype: tkaczanowski_sm
http://www.softwaremind.pl

Software Mind SA based in Krakow at ul. Bociana  22A, 31-231 Krakow
NIP 9452012822, seed capital PLN 500,000.00 (fully paid up)
District Court Kraków Śródmieście, XI Economics Department
of the National Court Register, KRS 0000300409

****************************** LEGAL DISCLAIMER*************************
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data corruption,
interception, tampering, unauthorized amendment and viruses. We only
send and receive emails on the basis that we are not liable for any
such corruption, interception, tampering, amendment or viruses or any
consequence thereof.

Reply | Threaded
Open this post in threaded view
|

Re: embedded karaf - hotdeploy & console

jbonofre
Hi Tomasz,

1/ for the hotdeploy folder, could you turn in debug to see if Felix
fileinstall is calling the deployer ?
2/ for the console, I guess that you talk about the ssh connection.
Could you check if the sshd server is started (for instance, checking if
the ssh and management features are correctly installed, and performing
a telnet on te given port), especially if there are some port overlap.

We can discuss about adding a war distribution of Karaf, or at least
document how to do it.

Regards
JB

On 02/01/2012 02:53 PM, Tomasz Kaczanowski wrote:

> Hi All,
>
> trying to run Karaf embedded within web application deployed to Jetty or
> JBoss. Yes, I know this is suboptimal, but well, I need it have it
> running inside some web container.
>
> So I managed to run Karaf by calling Main() within some web listener
> (invoked from web.xml), but:
>
> - hot deploy does not seem to work: OSGi bundles copied into
> WEB-INF/karaf/deploy are ignored (nothing happens)
> - I can't connect to local or remote console - even though I put system
> properties (System.setProperty("karaf.startLocalConsole",
> "true");System.setProperty("karaf.startRemoteShell", "true");) which
> should (AFAIK) start the console
>
> The question is if I'm hitting the limits of what embedded Karaf can do,
> or (most probably) I do it wrong. Is there any complete example of
> having fully-fledged Karaf running in embedded mode?
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: embedded karaf - hotdeploy & console

Tomasz Kaczanowski
JB,

thanks for your prompt reply.

>
> 1/ for the hotdeploy folder, could you turn in debug to see if Felix
> fileinstall is calling the deployer ?
You mean System.setProperty("KARAF_DEBUG", "true"); ? No additional output.
> 2/ for the console, I guess that you talk about the ssh connection.
> Could you check if the sshd server is started (for instance, checking
> if the ssh and management features are correctly installed, and
> performing a telnet on te given port), especially if there are some
> port overlap.
How should I check ssh and management features are installed?
BTW. I checked with netstat but found nothing on 8101. I tried to
configure ssh by putting org.apache.karaf.shell.cfg into karaf/etc

>
> We can discuss about adding a war distribution of Karaf, or at least
> document how to do it.
Please do.

--
Regards,
Tomek Kaczanowski

>
> Regards
> JB
>
> On 02/01/2012 02:53 PM, Tomasz Kaczanowski wrote:
>> Hi All,
>>
>> trying to run Karaf embedded within web application deployed to Jetty or
>> JBoss. Yes, I know this is suboptimal, but well, I need it have it
>> running inside some web container.
>>
>> So I managed to run Karaf by calling Main() within some web listener
>> (invoked from web.xml), but:
>>
>> - hot deploy does not seem to work: OSGi bundles copied into
>> WEB-INF/karaf/deploy are ignored (nothing happens)
>> - I can't connect to local or remote console - even though I put system
>> properties (System.setProperty("karaf.startLocalConsole",
>> "true");System.setProperty("karaf.startRemoteShell", "true");) which
>> should (AFAIK) start the console
>>
>> The question is if I'm hitting the limits of what embedded Karaf can do,
>> or (most probably) I do it wrong. Is there any complete example of
>> having fully-fledged Karaf running in embedded mode?
>>
>


--
Tomasz Kaczanowski
Senior Software Engineer

Software Mind SA| Where Quality Meets the Future
ul. Bociana 22a
31-231 Krakow
Poland
Tel. +48 12 252 34 00
Fax: +48 12 252 34 01
[hidden email]
skype: tkaczanowski_sm
http://www.softwaremind.pl

Software Mind SA based in Krakow at ul. Bociana  22A, 31-231 Krakow
NIP 9452012822, seed capital PLN 500,000.00 (fully paid up)
District Court Kraków Śródmieście, XI Economics Department
of the National Court Register, KRS 0000300409

****************************** LEGAL DISCLAIMER*************************
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data corruption,
interception, tampering, unauthorized amendment and viruses. We only
send and receive emails on the basis that we are not liable for any
such corruption, interception, tampering, amendment or viruses or any
consequence thereof.

Reply | Threaded
Open this post in threaded view
|

Re: embedded karaf - hotdeploy & console

jbonofre
Hi,

my comments inline:

On 02/01/2012 03:14 PM, Tomasz Kaczanowski wrote:
> JB,
>
> thanks for your prompt reply.
>
>>
>> 1/ for the hotdeploy folder, could you turn in debug to see if Felix
>> fileinstall is calling the deployer ?
> You mean System.setProperty("KARAF_DEBUG", "true"); ? No additional output.

No, at least turning the rootLogger in DEBUG (as you can do in
etc/org.ops4j.pax.logging.cfg file).

>> 2/ for the console, I guess that you talk about the ssh connection.
>> Could you check if the sshd server is started (for instance, checking
>> if the ssh and management features are correctly installed, and
>> performing a telnet on te given port), especially if there are some
>> port overlap.
> How should I check ssh and management features are installed?
> BTW. I checked with netstat but found nothing on 8101. I tried to
> configure ssh by putting org.apache.karaf.shell.cfg into karaf/etc

Are you able to access to the JMX layer ?
In the etc/org.apache.karaf.features.cfg, could you check that
management and ssh are bootFeatures ?

Regards
JB

>
>>
>> We can discuss about adding a war distribution of Karaf, or at least
>> document how to do it.
> Please do.
>
> --
> Regards,
> Tomek Kaczanowski
>
>>
>> Regards
>> JB
>>
>> On 02/01/2012 02:53 PM, Tomasz Kaczanowski wrote:
>>> Hi All,
>>>
>>> trying to run Karaf embedded within web application deployed to Jetty or
>>> JBoss. Yes, I know this is suboptimal, but well, I need it have it
>>> running inside some web container.
>>>
>>> So I managed to run Karaf by calling Main() within some web listener
>>> (invoked from web.xml), but:
>>>
>>> - hot deploy does not seem to work: OSGi bundles copied into
>>> WEB-INF/karaf/deploy are ignored (nothing happens)
>>> - I can't connect to local or remote console - even though I put system
>>> properties (System.setProperty("karaf.startLocalConsole",
>>> "true");System.setProperty("karaf.startRemoteShell", "true");) which
>>> should (AFAIK) start the console
>>>
>>> The question is if I'm hitting the limits of what embedded Karaf can do,
>>> or (most probably) I do it wrong. Is there any complete example of
>>> having fully-fledged Karaf running in embedded mode?
>>>
>>
>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: embedded karaf - hotdeploy & console

Tomasz Kaczanowski
JB,

from your answers I understand that my Karaf config is missing many
(crucial, I guess) files. No point in bothering you with this - I will
take some running distribution and try to run it in embedded mode. If it
fails, then I will come back with more reasonable questions. :)

Thanks!

--
Regards,
Tomek Kaczanowski

  On 02/01/2012 03:21 PM, Jean-Baptiste Onofré wrote:

> Hi,
>
> my comments inline:
>
> On 02/01/2012 03:14 PM, Tomasz Kaczanowski wrote:
>> JB,
>>
>> thanks for your prompt reply.
>>
>>>
>>> 1/ for the hotdeploy folder, could you turn in debug to see if Felix
>>> fileinstall is calling the deployer ?
>> You mean System.setProperty("KARAF_DEBUG", "true"); ? No additional
>> output.
>
> No, at least turning the rootLogger in DEBUG (as you can do in
> etc/org.ops4j.pax.logging.cfg file).
>
>>> 2/ for the console, I guess that you talk about the ssh connection.
>>> Could you check if the sshd server is started (for instance, checking
>>> if the ssh and management features are correctly installed, and
>>> performing a telnet on te given port), especially if there are some
>>> port overlap.
>> How should I check ssh and management features are installed?
>> BTW. I checked with netstat but found nothing on 8101. I tried to
>> configure ssh by putting org.apache.karaf.shell.cfg into karaf/etc
>
> Are you able to access to the JMX layer ?
> In the etc/org.apache.karaf.features.cfg, could you check that
> management and ssh are bootFeatures ?
>
> Regards
> JB
>
>>
>>>
>>> We can discuss about adding a war distribution of Karaf, or at least
>>> document how to do it.
>> Please do.
>>
>> --
>> Regards,
>> Tomek Kaczanowski
>>
>>>
>>> Regards
>>> JB
>>>
>>> On 02/01/2012 02:53 PM, Tomasz Kaczanowski wrote:
>>>> Hi All,
>>>>
>>>> trying to run Karaf embedded within web application deployed to
>>>> Jetty or
>>>> JBoss. Yes, I know this is suboptimal, but well, I need it have it
>>>> running inside some web container.
>>>>
>>>> So I managed to run Karaf by calling Main() within some web listener
>>>> (invoked from web.xml), but:
>>>>
>>>> - hot deploy does not seem to work: OSGi bundles copied into
>>>> WEB-INF/karaf/deploy are ignored (nothing happens)
>>>> - I can't connect to local or remote console - even though I put
>>>> system
>>>> properties (System.setProperty("karaf.startLocalConsole",
>>>> "true");System.setProperty("karaf.startRemoteShell", "true");) which
>>>> should (AFAIK) start the console
>>>>
>>>> The question is if I'm hitting the limits of what embedded Karaf
>>>> can do,
>>>> or (most probably) I do it wrong. Is there any complete example of
>>>> having fully-fledged Karaf running in embedded mode?
>>>>
>>>
>>
>>
>


--
Tomasz Kaczanowski
Senior Software Engineer

Software Mind SA| Where Quality Meets the Future
ul. Bociana 22a
31-231 Krakow
Poland
Tel. +48 12 252 34 00
Fax: +48 12 252 34 01
[hidden email]
skype: tkaczanowski_sm
http://www.softwaremind.pl

Software Mind SA based in Krakow at ul. Bociana  22A, 31-231 Krakow
NIP 9452012822, seed capital PLN 500,000.00 (fully paid up)
District Court Kraków Śródmieście, XI Economics Department
of the National Court Register, KRS 0000300409

****************************** LEGAL DISCLAIMER*************************
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data corruption,
interception, tampering, unauthorized amendment and viruses. We only
send and receive emails on the basis that we are not liable for any
such corruption, interception, tampering, amendment or viruses or any
consequence thereof.

Reply | Threaded
Open this post in threaded view
|

Re: embedded karaf - hotdeploy & console

luke
Hey Tomek,
Embedding OSGi in container is a bit tricky. From my understanding most critical is lack of configuration directory. Karaf install many etc/*.cfg files as cofigurations for ConfigAdmin. relying on defaults should start something, but first of all check framework.
To ensure that everythings works well make sure that Felix starts correctly. First step is to check directory configured by org.osgi.framework.storage. You should have there few sub-directories (bundle1, bundle2, bundleN). Ensure that karaf loads correctly properies - especially startup.properties. I guess that nothing is started because you can not connect to remote shell. Also, I recommend to disable local console. In/out streams are usually wrapped by JSP compilers.
If you wish you might reffer my article about embedding aries [1], which uses a bit different approach and allows you to re-use web connector. 


Pozdrawiam :)
Łukasz Dywicki
--
Code-House
http://code-house.org

Wiadomość napisana przez Tomasz Kaczanowski w dniu 1 lut 2012, o godz. 15:52:

JB,

from your answers I understand that my Karaf config is missing many (crucial, I guess) files. No point in bothering you with this - I will take some running distribution and try to run it in embedded mode. If it fails, then I will come back with more reasonable questions. :)

Thanks!

--
Regards,
Tomek Kaczanowski

On 02/01/2012 03:21 PM, Jean-Baptiste Onofré wrote:
Hi,

my comments inline:

On 02/01/2012 03:14 PM, Tomasz Kaczanowski wrote:
JB,

thanks for your prompt reply.


1/ for the hotdeploy folder, could you turn in debug to see if Felix
fileinstall is calling the deployer ?
You mean System.setProperty("KARAF_DEBUG", "true"); ? No additional output.

No, at least turning the rootLogger in DEBUG (as you can do in etc/org.ops4j.pax.logging.cfg file).

2/ for the console, I guess that you talk about the ssh connection.
Could you check if the sshd server is started (for instance, checking
if the ssh and management features are correctly installed, and
performing a telnet on te given port), especially if there are some
port overlap.
How should I check ssh and management features are installed?
BTW. I checked with netstat but found nothing on 8101. I tried to
configure ssh by putting org.apache.karaf.shell.cfg into karaf/etc

Are you able to access to the JMX layer ?
In the etc/org.apache.karaf.features.cfg, could you check that management and ssh are bootFeatures ?

Regards
JB



We can discuss about adding a war distribution of Karaf, or at least
document how to do it.
Please do.

--
Regards,
Tomek Kaczanowski


Regards
JB

On 02/01/2012 02:53 PM, Tomasz Kaczanowski wrote:
Hi All,

trying to run Karaf embedded within web application deployed to Jetty or
JBoss. Yes, I know this is suboptimal, but well, I need it have it
running inside some web container.

So I managed to run Karaf by calling Main() within some web listener
(invoked from web.xml), but:

- hot deploy does not seem to work: OSGi bundles copied into
WEB-INF/karaf/deploy are ignored (nothing happens)
- I can't connect to local or remote console - even though I put system
properties (System.setProperty("karaf.startLocalConsole",
"true");System.setProperty("karaf.startRemoteShell", "true");) which
should (AFAIK) start the console

The question is if I'm hitting the limits of what embedded Karaf can do,
or (most probably) I do it wrong. Is there any complete example of
having fully-fledged Karaf running in embedded mode?







--
Tomasz Kaczanowski
Senior Software Engineer

Software Mind SA| Where Quality Meets the Future
ul. Bociana 22a
31-231 Krakow
Poland
Tel. +48 12 252 34 00
Fax: +48 12 252 34 01
[hidden email]
skype: tkaczanowski_sm
http://www.softwaremind.pl

Software Mind SA based in Krakow at ul. Bociana  22A, 31-231 Krakow
NIP 9452012822, seed capital PLN 500,000.00 (fully paid up)
District Court Kraków Śródmieście, XI Economics Department
of the National Court Register, KRS 0000300409

****************************** LEGAL DISCLAIMER*************************
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data corruption,
interception, tampering, unauthorized amendment and viruses. We only
send and receive emails on the basis that we are not liable for any
such corruption, interception, tampering, amendment or viruses or any
consequence thereof.