You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by to...@quarendon.net on 2016/09/21 13:23:04 UTC

Create and manager an instance using Jolokia

How do I create and then manage a new instance using jolokia?

I can execute the commands on my root instance to create and start a new
instance fine. On create I specify that I want "jolokia" as a feature.

Fundamentally, in order to manage the second instance I have to connect directly
to it don't I? This is fine with the RMI, as I get the opportunity to set the
ports on instance creation. Despite the instance name being in the Mbean object
names (the "name=[instance]" bit), I can't connect to the root instance and
control the second instance simply by setting "name=second" (doesn't work
anyway).

So I'm going to need to set the HTTP port on the second instance to something
other than default, otherwise I won't be able to connect, the second instance
will attempt to bind to 8181, and then fail.

I seem to have two ways I might be able to influence the new instance. 
The first is that I have the opportunity to pass in startup options when the
instance is started. Can I influence the port that way? These are presumably
java system options, but I'm not aware you can set OSGi configuration from
system options can you? Or indeed that the HTTP service will pick up a specific
system option?

The second opportunity seems to be that on creating the instance, I can pass in
feature URLs and features to install. Presumably I could pass in the URL of a
feature XML file that contains a feature that just has configuration settings in
it. But in order to do this, I have to have created that feature XML file though
and have in a location that is addressable by a URL from the machine on which
Karaf is running, I can't just pass the information in easily.

Are there any other ways of achieving this that I've missed?

Thanks for any input.

Re: Create and manager an instance using Jolokia

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

Jolokia use the http service port. So, when you install jolokia, it 
installs http feature.

To change the port, you have to provision org.ops4j.pax.web.cfg file 
containing the port property in the etc folder of the instance, or using 
config layer before installing the http/jolokia feature.

Regards
JB

On 09/21/2016 03:23 PM, tom@quarendon.net wrote:
> How do I create and then manage a new instance using jolokia?
>
> I can execute the commands on my root instance to create and start a new
> instance fine. On create I specify that I want "jolokia" as a feature.
>
> Fundamentally, in order to manage the second instance I have to connect directly
> to it don't I? This is fine with the RMI, as I get the opportunity to set the
> ports on instance creation. Despite the instance name being in the Mbean object
> names (the "name=[instance]" bit), I can't connect to the root instance and
> control the second instance simply by setting "name=second" (doesn't work
> anyway).
>
> So I'm going to need to set the HTTP port on the second instance to something
> other than default, otherwise I won't be able to connect, the second instance
> will attempt to bind to 8181, and then fail.
>
> I seem to have two ways I might be able to influence the new instance.
> The first is that I have the opportunity to pass in startup options when the
> instance is started. Can I influence the port that way? These are presumably
> java system options, but I'm not aware you can set OSGi configuration from
> system options can you? Or indeed that the HTTP service will pick up a specific
> system option?
>
> The second opportunity seems to be that on creating the instance, I can pass in
> feature URLs and features to install. Presumably I could pass in the URL of a
> feature XML file that contains a feature that just has configuration settings in
> it. But in order to do this, I have to have created that feature XML file though
> and have in a location that is addressable by a URL from the machine on which
> Karaf is running, I can't just pass the information in easily.
>
> Are there any other ways of achieving this that I've missed?
>
> Thanks for any input.
>

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