You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by braus <s....@gaston-schul.com> on 2020/04/22 10:20:18 UTC
Karaf Cellar getting the HazelCastInstance
Hello everyone,
I'm trying to get the HazelCastInstance on a karaf installation where I
installed cellar.
I try to get the HazelCastInstance like:
BundleContext bc =
FrameworkUtil.getBundle(thisclass.class).getBundleContext();
ServiceReference<HazelcastInstance> sr =
bc.getServiceReference(HazelcastInstance.class);
HazelcastInstance hci = bc.getService(sr);
Unfortunately the service reference is null. I have two karaf's running
which are connected to one another. Does anyone have an idea on how to get
the HazelCastInstance?
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Karaf Cellar getting the HazelCastInstance
Posted by braus <s....@gaston-schul.com>.
I made a mistake in that the application was running before Hazelcast..
I fixed it by waiting now. In the future I'll use blueprint to wait instead.
Thanks for helping out!
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Karaf Cellar getting the HazelCastInstance
Posted by braus <s....@gaston-schul.com>.
Thanks for replying JB,
I followed your instructions and it's there:
karaf@root()> la | grep -i hazelcast
45 │ Active │ 80 │ 3.12.6 │ hazelcast
65 │ Active │ 80 │ 4.1.3 │ Apache Karaf :: Cellar ::
Hazelcast
98 │ Active │ 80 │ 1.5.3 │ Apache Shiro :: Support ::
Hazelcast
karaf@root()> bundle:services 65
Apache Karaf :: Cellar :: Hazelcast (65) provides:
--------------------------------------------------
[org.osgi.service.cm.ManagedService]
[com.hazelcast.core.HazelcastInstance]
[org.apache.karaf.cellar.core.ClusterManager]
The only difference that I see is that I'm using a different hazelcast
(hazelcast-all) version (I need a higher).
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Karaf Cellar getting the HazelCastInstance
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,
Can you check that hazelcast and cellar hazelcast bundles are started ?
karaf@root()> la|grep -i hazelcast
107 x Active x 80 x 3.9.1 x hazelcast
114 x Active x 80 x 4.1.3 x Apache Karaf :: Cellar :: Hazelcast
I can see the HazelcastInstance available in the service registry provided by Cellar Instance bundle:
bundle:services 114
Apache Karaf :: Cellar :: Hazelcast (114) provides:
---------------------------------------------------
...
[com.hazelcast.core.HazelcastInstance]
...
Regards
JB
> Le 22 avr. 2020 à 12:20, braus <s....@gaston-schul.com> a écrit :
>
> Hello everyone,
>
> I'm trying to get the HazelCastInstance on a karaf installation where I
> installed cellar.
> I try to get the HazelCastInstance like:
>
> BundleContext bc =
> FrameworkUtil.getBundle(thisclass.class).getBundleContext();
> ServiceReference<HazelcastInstance> sr =
> bc.getServiceReference(HazelcastInstance.class);
> HazelcastInstance hci = bc.getService(sr);
>
> Unfortunately the service reference is null. I have two karaf's running
> which are connected to one another. Does anyone have an idea on how to get
> the HazelCastInstance?
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html