Hi!
I have a small problem with creating own custom bundle which uses
MetaContactListService. I created this class with uses BundleActivator
interface :
public class CustomActivator2 implements BundleActivator {
public static BundleContext bundleContext;
private static MetaContactListService metaContactListService;
public void start(BundleContext bc) throws Exception {
CustomActivator2.bundleContext = bc;
try {
metaContactListService = new MetaContactListServiceImpl();
bundleContext.registerService(MetaContactListService.class.getName(),
metaContactListService, null);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void stop(BundleContext bc) throws Exception {
}
public static MetaContactListService getMetaContastList() {
if (metaContactListService == null) {
metaContactListService
= ServiceUtils.getService(
bundleContext,
MetaContactListService.class);
}
return metaContactListService;
}
}
I also added a few lines to build.xml like this one :
<!--BUNDLE-CUSTOM-->
<target name="bundle-custom">
<jar compress="false" destfile="${bundles.dest}/custom.jar"
manifest="${src}/net/java/sip/communicator/impl/custom/custom.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/custom"
prefix="net/java/sip/communicator/impl/custom"/>
</jar>
</target>
During the Jitsi start and invoking this bundle i receive this message :
java.lang.NoClassDefFoundError:
net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl
[java] at
net.java.sip.communicator.impl.custom.CustomActivator2.start(CustomActivator2.java:29)
[java] at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
[java] at
org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
[java] at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
[java] at
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
[java] at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
[java] at java.lang.Thread.run(Thread.java:745)
[java] Caused by: java.lang.ClassNotFoundException:
net.java.sip.communicator.impl.contactlist.MetaContactListServiceImpl not
found by net.java.sip.communicator.custom [198]
[java] at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
[java] at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
[java] at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
When I add missing import net.java.sip.communicator.impl.contactlist to
manifest file I receive this message :
org.osgi.framework.BundleException: Unresolved constraint in bundle
net.java.sip.communicator.custom [198]: Unable to resolve 198.0: missing
requirement [198.0] package;
(package=net.java.sip.communicator.impl.contactlist)
[java] at
org.apache.felix.framework.Felix.resolveBundle(Felix.java:3564)
[java] at org.apache.felix.framework.Felix.startBundle(Felix.java:1797)
[java] at
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
[java] at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
[java] at java.lang.Thread.run(Thread.java:745)
[java] ERROR: Bundle net.java.sip.communicator.custom [198] Error
starting reference:file:sc-bundles/custom.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle
net.java.sip.communicator.custom [198]: Unable to resolve 198.0: missing
requirement [198.0] package;
(package=net.java.sip.communicator.impl.contactlist))
There is any work around how to make this bundle to work and be able to get
contacts from Jitsi using MetaContactListService. Much appreciated for any
help!
Best regards,
Łukasz