You can not mix Activator and blueprint. Either go with an Activator or with blueprint. If you do both then you end up with two instances of your class one created by blueprint and one by the activator.

For blueprint:

<reference-list id="busList" member-type="service-object"
interface="org.apache.cxf.Bus" />


<bean class="br.ufba.dcc.wiser.smartufba.mqttfuseki.MqttCxfControllerImpl">
  <property name="busList ref="busList">
</bean>


Christian

On 05.07.2016 21:59, Leandro Andrade wrote:
Hi Christian,

I tried implemented what you suggested.
I did a file with blueprint
(main/resources/OSGI-INF/blueprint/blueprint.xml)

Firstly, inside blueprint tag I put:

<reference-list id="busList" member-type="service-object"
interface="org.apache.cxf.Bus" />

After I tried:

<reference-list id="busList" interface="org.apache.cxf.Bus">
<reference-listener bind-method="setBusList">
<bean class="br.ufba.dcc.wiser.smartufba.mqttfuseki.MqttCxfControllerImpl"
/>
</reference-listener>
</reference-list>

The both my attribute busList are null. I tried initialize it but had the
same execption that I said in first e-mail.

Other information:

In my bundle the Activator class I create new Thread and I instance my
class MqttCxfControllerImpl. like it:

public void start(BundleContext bc) throws Exception {
         System.out.println("Starting the bundle MQTT Fuseki");
         new Thread (new Runnable()
         {
         public void run(){
         MqttCxfControllerImpl mf = null;
try {
mf = new MqttCxfControllerImpl(...);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
        }}).start();


Thus, I did something wrong?

Thanks again.


Regards,


Leandro Andrade


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to