Search code examples
osgiapache-felixjitsifelix-dependency-manager

Jitsi include external jar for customization


Currently I am working on customization of Open Source Jitsi. And Somehow, I want to add 3rd party jar for customization.

I tried a lot to include 3rd party jar but I am facing this error.

So please help me to get rid of this error or provide some guidance to add 3rd party jar .

Auto-properties install: reference:file:sc-bundles/commons-vfs2-2.0.jar (org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar - java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar)
     [java] org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar
     [java]     at org.apache.felix.framework.Felix.installBundle(Felix.java:2876)
     [java]     at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
     [java]     at org.apache.felix.main.AutoProcessor.processAutoProperties(AutoProcessor.java:296)
     [java]     at org.apache.felix.main.AutoProcessor.process(AutoProcessor.java:79)
     [java]     at org.apache.felix.main.Main.main(Main.java:292)
     [java]     at net.java.sip.communicator.launcher.SIPCommunicator.main(SIPCommunicator.java:219)
     [java] Caused by: java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar
     [java]     at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:852)
     [java]     at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
     [java]     at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
     [java]     at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
     [java]     at org.apache.felix.framework.Felix.installBundle(Felix.java:2872)
     [java]     ... 5 more

Solution

  • Add your JAR file (custom.jar) to the lib/ directory. Then edit the two files as indicated below:

    jitsi.eml - Add the following entry to the file :

    <lib name="custom.jar" scope="COMPILE">
        <relative-module-cls project-related="jar://$PROJECT_DIR$/lib/custom.jar!/"/>
    </lib>
    

    nbproject/project.xml - Search for <classpath mode="compile"> (there are two such occurences) and enlist your jar file as

    <classpath mode="compile">lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
    

    and

    <classpath mode="compile">classes:lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
    

    After editing the files, run ant clean; ant clean-bundles; ant make

    And you are good to go.