felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fairouz Fakhfakh <fairouz.fakhf...@gmail.com>
Subject create instance iPOJO
Date Tue, 20 Mar 2012 10:34:09 GMT
Hello,
I would like to create a dynamic instance with iPOJO.
I tried to follow this link:
http://www.scribd.com/doc/64361631/130/Instantiating-components-with-iPOJO
page 406
I try to write this method "create":

private Factory helloFactory;
private Map<String, ComponentInstance> instances =new HashMap<String,
ComponentInstance>();
*public void create(String name) *
{ Hashtable props = new Hashtable();
props.put("kind", name);
ComponentInstance instance = null;
try {
instance = helloFactory.createComponentInstance(props);

} catch (UnacceptableConfiguration e) {
 e.printStackTrace();
} catch (MissingHandlerException e) {
 e.printStackTrace();
} catch (org.apache.felix.ipojo.ConfigurationException e) {
 e.printStackTrace();
}
instances.put(name, instance);
}

But it generates this error: Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException
        at trmcs.alarm.HelpSe
rviceAlarmImpl.__create(HelpServiceAlarmImpl.java:107)
in the line:* **instance = helloFactory.createComponentInstance(props);*
So, I understand that helloFactory is null.
But, I dont' know why can I correct that to create an instance of a
component?
Thank for answering me.
Best regards,

--
Fairouz Fakhfakh

Master Student
National School of Engineers of SFAX

Research group ReDCAD
http://WWW.redcad.org <http://www.redcad.org/>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message