Hard to say what is going on from the information provided. I assume you
are using Felix 1.8.0. There is at least this mistake:
*configMap.put(**"org.osgi.framework.startlevel.beginning","0")**;*
Not sure why all the *'s are there, but you cannot set the beginning
start level to 0...it should be greater than zero.
You should be getting some errors if the bundles cannot be loaded.
Directory 0 in the bundle cache is usually empty, since it is for the
system bundle.
-> richard
On 6/24/09 4:23 AM, Marta Luna Serrano wrote:
> Hello,
> I am trying to embed felix into a Web Page as an applet, but it doesn't run.
> I don't have any error in the Java Console, but the cache directory only has
> a bundle0 directory and it is empty... so I think that I have a problem with
> the auto start properties or something like that.
> Any help will be wellcome!!
> Regards
> Marta
>
> This is the code I use to config felix properties:
>
> * *
>
> *import** java.io.File;*
> * *
>
> *import** java.util.ArrayList;*
> * *
>
> *import** java.util.List;*
> * *
>
> *import** java.util.Map;*
> * *
>
> *import** java.util.HashMap;*
>
> **
>
> *import** javax.swing.JApplet;*
>
> **
> * *
>
> *import** net.java.sip.communicator.impl.applet.AppletActivator;*
>
> **
> * *
>
> *import** org.apache.felix.framework.Felix;*
> * *
>
> *import** org.apache.felix.framework.cache.BundleCache;*
> * *
>
> *import** org.apache.felix.framework.util.FelixConstants;*
> * *
>
> *import** org.apache.felix.framework.util.StringMap;*
> * *
>
> *import** org.apache.felix.main.AutoActivator;*
> * *
>
> *import** org.osgi.framework.BundleException;*
> * *
>
> *import** org.osgi.framework.Constants;*
>
> **
>
> *public** class** SIPCommunicatorApplet extends** JApplet {*
>
> *// the felix cache directory*
>
> *private** static** final** String CACHE_DIR = ".SIPCommDoctorApplet/bin"**;
> *
>
> **
>
> *// the old config file - sip-communicator.xml*
> **
>
> *private** File oldConfigFile = null**;*
>
> **
>
> *// the old contact list file - contactlist.xml*
> **
>
> *private** File oldContactlistFile = null**;*
>
> **
>
> *// the user's home dir*
> **
>
> *private** String userHome = null**;*
>
> **
>
> *private** static** final** long** serialVersionUID** =
> -2876656913837180952L;*
>
> **
>
> *// the auto-start property for felix 1.4*
>
> *//private static final String AUTO_START = FelixConstants. AUTO_START;*
>
> *private** static** final** String AUTO_START_PROP = AutoActivator.
> AUTO_START_PROP**; *
>
> **
>
> *// the felix instance*
>
> *private** Felix felix = null**;*
>
> **
>
> *// private HostActivator m_activator = null;*
>
> **
>
> *// the activator for the applet bundle*
>
> *private** AppletActivator appletActivator = null**;*
>
> **
>
> **
>
> *public** void** init()*
>
> *{*
>
> **
>
> *userHome = System.getProperty("user.home") + File.separator**;*
>
> *System.**out.println("El el user home es: " + userHome);*
> **
>
> *// remove the cache dir from a previous startup to make sure that the new
> bundles are loaded*
>
> *File existingCacheDir = **new** File(userHome + CACHE_DIR**); *
>
> *System.**out.println("ExistingCacheDir: "**+ existingCacheDir);*
>
> *//rename the config files - maybe there is a local instance of sipCom, we
> would otherwise overwrite the config files*
>
> *oldConfigFile = new** File(userHome +
> ".sip-communicator/sip-communicator.xml"**);*
>
> *if** (oldConfigFile**.exists())*
>
> *{*
>
> *File newFile = **new** File(userHome +
> ".sip-communicator/sip-communicator.xml."** + System.currentTimeMillis());*
>
> *if** (oldConfigFile**.renameTo(newFile))*
>
> *{*
>
> *oldConfigFile** = newFile;*
>
> *}*
>
> *}*
>
> **
>
> *oldContactlistFile = new** File(userHome +
> ".sip-communicator/contactlist.xml"**);*
>
> *if** (oldContactlistFile**.exists())*
>
> *{*
>
> *File newFile = **new** File(userHome + ".sip-communicator/contactlist.xml."
> ** + System.currentTimeMillis());*
>
> *if** (oldContactlistFile**.renameTo(newFile))*
>
> *{*
>
> *oldContactlistFile** = newFile;*
>
> *}*
>
> *}*
>
> **
>
> **
>
> *// use the codeBase as the server we are running on*
>
> *String server = getCodeBase().toString();*
>
> **
>
> *// Print welcome banner.*
>
> *System.**out.println("\nWelcome to Felix."**);*
>
> *System.**out.println("=================\n"**);*
>
> **
>
> *// Create a configuration property map.*
>
> *Map configMap = **new** StringMap(false**);*
>
> **
>
> **
>
> **
> *List list = **new** ArrayList();*
>
> *configMap.put(FelixConstants.**SYSTEMBUNDLE_ACTIVATORS_PROP, list)**;*
>
> **
>
> **
>
> **
> *configMap.put(Constants.**FRAMEWORK_SYSTEMPACKAGES, *
>
> *"org.osgi.framework; version=1.3.0," + *
>
> *"javax.swing;" + *
>
> *"javax.swing.event;" +*
>
> *"javax.swing.table;" +*
>
> *"javax.swing.text;" +*
>
> *"javax.swing.text.html;" +*
>
> *"javax.accessibility; "+*
>
> *"javax.swing.plaf;" +*
>
> *"javax.swing.plaf.metal;" +*
>
> *"javax.swing.plaf.basic; "+*
>
> *"javax.imageio; "+*
>
> *"javax.swing.tree;" +*
>
> *"javax.swing.undo;" +*
>
> *"javax.swing.event;" +*
>
> *"javax.swing.border;" +*
>
> *"javax.swing.filechooser;" +*
>
> *"org.w3c.dom;" +*
>
> *"org.xml.sax;" +*
>
> *"org.xml.sax.ext;" +*
>
> *"javax.xml.parsers;"+*
>
> *"org.apache.xml.serialize;" +*
>
> *"javax.xml.transform;" +*
>
> *"javax.xml.transform.dom;" +*
>
> *"javax.xml.transform.stream;" +*
>
> *"sun.security.action;" +*
>
> *"sun.misc;" +*
>
> *"javax.net;"+ *
>
> *"javax.net.ssl;" +*
>
> *"javax.naming;" +*
>
> *"javax.naming.directory;" +*
>
> *"javax.sound;"+*
>
> *"javax.sound.sampled;" +*
>
> *"org.jdesktop.jdic.tray;" +*
>
> *"org.jdesktop.jdic.desktop;" +*
>
> *"com.apple.cocoa.application;" +*
>
> *"com.apple.cocoa.foundation;" +*
>
> *"com.apple.eawt;" +*
>
> *"com.apple.eio;" +*
>
> *"quicktime;" +*
>
> *"quicktime.std.sg;" +*
>
> *"quicktime.qd;" +*
>
> *"quicktime.util;" +*
>
> *"quicktime.std.image;" +*
>
> *"org.xml.sax.helpers;" +*
>
> *"javax.crypto;" +*
>
> *"javax.crypto.spec;" +*
>
> *"javax.crypto.interfaces;" +*
>
> *"net.java.sip.communicator.util.launchutils;" +*
>
> *"org.bouncycastle.jce.provider;" +*
>
> *"org.bouncycastle.crypto.digests;" +*
>
> *"org.bouncycastle.crypto.macs;" +*
>
> *"org.bouncycastle.crypto.params;" +*
>
> *"org.bouncycastle.crypto.engines;" +*
>
> *"org.apache.log4j;" +*
>
> *"org.apache.commons.logging;" +*
>
> * *
>
> **
> *"javax.xml.messaging;" + *
>
> *"javax.xml.namespace;" +*
>
> *"javax.xml.rpc;" +*
>
> *"javax.xml.rpc.handler;" +*
>
> *"javax.xml.rpc.handler.soap;" +*
>
> *"javax.xml.rpc.holders;" +*
>
> *"javax.xml.soap;" +*
>
> *"net.java.sip.communicator.service.applet;")**;*
>
> **
>
> *// add all the bundles we need to the config map*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".10",*
>
> *server + "lib/bundle/org.apache.felix.bundlerepository-1.0.0.jar")**;*
>
> *System.**out.println("auto start 10"**);*
>
> *System.**out**.println(server);*
>
> *configMap.put(**AUTO_START_PROP +".20",*
>
> *server + "sc-bundles/util.jar " + *
>
> *server + "lib/bundle/log4j.jar")**;*
>
> *System.**out.println("auto start 20"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".30",*
>
> *server + "sc-bundles/fileaccess.jar")**;*
>
> *System.**out.println("auto start 30"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".40",*
>
> *server + "sc-bundles/configuration.jar " +*
>
> *server + "sc-bundles/resourcemanager.jar " +*
>
> *server + "sc-bundles/jfontchooserlib.jar " +*
>
> *server + "sc-bundles/browserlauncher.jar")**;*
>
> *System.**out.println("auto start 40"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".42",*
>
> *server + "sc-bundles/defaultresources.jar")**;*
>
> *System.**out.println("auto start 42"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".45",*
>
> *server + "sc-bundles/ui-service.jar " +*
>
> *server + "sc-bundles/argdelegation-service.jar " +*
>
> *server + "sc-bundles/version.jar " +*
>
> *server + "sc-bundles/version-impl.jar " +*
>
> *server + "sc-bundles/branding.jar")**;*
>
> *System.**out.println("auto start 45"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP +".49",*
>
> *server + "sc-bundles/zrtp4j.jar " +*
>
> *server + "sc-bundles/protocol.jar")**;*
>
> *System.**out.println("auto start 49"**);*
>
> **
>
> *//the contact list service depends on protocol.jar*
>
> *//some protocol implementations however depend on the contact list*
>
> *//so make sure load the procotol service first, the contact list next*
>
> *// and the implementations only after*
>
> *configMap.put(**AUTO_START_PROP+ ".50",*
>
> *server + "sc-bundles/contactlist.jar")**;*
>
> *System.**out.println("auto start 50"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".52",*
>
> *server + "sc-bundles/media.jar " +*
>
> *// server + "sc-bundles/protocol-icq.jar" +*
> * *
>
> *server + "sc-bundles/protocol-sip.jar " +*
>
> *// server + "sc-bundles/smacklib.jar" +*
> * *
>
> *// server + "sc-bundles/protocol-jabber.jar" +*
> * *
>
> *// server + "sc-bundles/protocol-msn.jar"+ *
> * *
>
> *// server + "sc-bundles/protocol-yahoo.jar" +*
> * *
>
> *// server + "sc-bundles/protocol-gibberish.jar" +*
> * *
>
> *// server + "sc-bundles/protocol-ssh.jar" +*
> * *
>
> *server + "sc-bundles/netaddr.jar " +*
>
> *// server + "sc-bundles/protocol-zeroconf.jar" +*
> * *
>
> *// server + "sc-bundles/protocol-irc.jar" +*
> * *
>
> *server + "sc-bundles/protocol-dict.jar")**;*
>
> *System.**out.println("auto start 52"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".55",*
>
> *server + "sc-bundles/meta-cl.jar")**;*
>
> *System.**out.println("auto start 55"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".56",*
>
> *server + "sc-bundles/protocol-rss.jar")**;*
>
> *System.**out.println("auto start 56"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".60", *
>
> *server + "sc-bundles/history.jar " +*
>
> *server + "sc-bundles/msghistory.jar " +*
>
> *server + "sc-bundles/callhistory.jar " +*
>
> *server + "sc-bundles/audionotifier.jar " +*
>
> *server + "sc-bundles/keybindings.jar " +*
>
> *server + "sc-bundles/notification.jar")**;*
>
> *System.**out.println("auto start 60"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP+ ".66",*
>
> *server + "sc-bundles/swing-ui.jar " +*
>
> *server + "sc-bundles/updatechecker.jar " +*
>
> *server + "sc-bundles/systray.jar")**;*
>
> *System.**out.println("auto start 66"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".67", *
>
> *server + "sc-bundles/pluginmanager.jar " +*
>
> *server + "sc-bundles/whiteboard.jar " +*
>
> *// server + "sc-bundles/icqaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/aimaccregwizz.jar" +*
> * *
>
> *server + "sc-bundles/sipaccregwizz.jar " +*
>
> *// server + "sc-bundles/jabberaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/googletalkaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/msnaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/yahooaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/gibberishaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/sshaccregwizz.jar" +*
> * *
>
> *server + "sc-bundles/callhistoryform.jar " + *
>
> *// server + "sc-bundles/rssaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/zeroconfaccregwizz.jar" +*
> * *
>
> *// server + "sc-bundles/ircaccregwizz.jar" +*
> * *
>
> *server + "sc-bundles/contacteventhandler.jar " +*
>
> *server + "sc-bundles/notificationconfig.jar " +*
>
> *server + "sc-bundles/contactinfo.jar " +*
>
> *server + "sc-bundles/accountinfo.jar " +*
>
> *server + "sc-bundles/chatalerter.jar " +*
>
> *server + "sc-bundles/autoaway.jar " +*
>
> *server + "sc-bundles/keybindingChooser.jar " +*
>
> *server + "sc-bundles/generalconfig.jar " +*
>
> *server + "sc-bundles/dictaccregwizz.jar")**;*
>
> *System.**out.println("auto start 67"**);*
>
> **
>
> *//level 68 is for profiler, don't use it or change the build.xml file
> accordingly*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".70", *
>
> *server + "sc-bundles/simpleaccreg.jar")**;*
>
> *System.**out.println("auto start 70"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".75",*
>
> *server + "sc-bundles/argdelegation.jar")**;*
>
> *System.**out.println("auto start 75"**);*
>
> **
>
> *configMap.put(**AUTO_START_PROP + ".80", *
>
> *server + "sc-bundles/shutdown.jar")**;*
>
> *System.**out.println("auto start 80"**);*
>
> **
>
> *// Uncomment the following lines if you want to run the architect viewer*
>
> *// bundle.*
>
> *//configMap.put(AUTO_START_PROP + ".100",*
>
> *//server + "lib/bundle/architectureviewer1.1.jar");*
>
> **
>
> *System.**out**.println(configMap);*
>
> **
>
> **
>
> *configMap.put(**"org.osgi.framework.storage",CACHE_DIR)**;*
>
> **
>
> **
>
> **
> *configMap.put(**"org.osgi.framework.startlevel", "100")**;*
>
> *configMap.put(**"felix.startlevel.framework", "100")**;*
>
> *configMap.put(**"felix.startlevel", "100")**;*
>
> *configMap.put(**"org.osgi.framework.startlevel.beginning","0")**;*
>
> **
>
> **
>
> *// this prevents felix from loading stream and content factories a second
> time*
>
> **
>
> **
>
> **
>
> **
>
> *// create an AppletActivator to make this applet available to the framework
> *
>
> *appletActivator = new** AppletActivator(this**);*
>
> **
>
> *// add this appletActivator to the parameter list for felix*
>
> *list.add(**appletActivator)**;*
>
> **
>
> **
>
> *try*
>
> *{*
>
> *// Now create an instance of the framework.*
>
> *felix = new** Felix(configMap);*
>
> *// and start it!*
>
> *felix**.start();*
>
> *System.**out.println("Se crea el framework"**);*
>
> *}*
>
> *catch** (Exception ex)*
>
> *{*
>
> *System.**err.println("Could not create framework: "** + ex);*
>
> *ex.printStackTrace();*
>
> *} *
>
> *}*
>
> **
>
> *public** void** start()*
>
> *{*
>
> *// System.out.println("Entramos en start");*
>
> **
>
> *}*
>
> **
>
> *public** void** stop()*
>
> *{*
>
> **
>
> *}*
>
> **
>
> **
>
> *public** void** destroy()*
>
> *{*
>
> **
>
> *// Shut down the felix framework when stopping the*
>
> *// host application.*
>
> *try*
>
> *{*
>
> *felix**.stop();*
>
> *} **catch** (BundleException e)*
>
> *{*
>
> *e.printStackTrace();*
>
> *}*
>
> **
>
> *//delete the applet config files*
>
> *File configFile = **new** File(userHome +
> ".SIPCommDoctorApplet/sip-communicator.xml"**);*
>
> *if** (configFile.exists())*
>
> *{*
>
> *configFile.delete();*
>
> *}*
>
> **
>
> *File contactListFile = **new** File(userHome +
> ".SIPCommDoctorApplet/contactlist.xml"**);*
>
> *if** (contactListFile.exists())*
>
> *{*
>
> *contactListFile.delete();*
>
> *}*
>
> **
>
> *//rename the old config files *
>
> *if** (oldConfigFile**.exists())*
>
> *{*
>
> *oldConfigFile.renameTo(new** File(userHome +
> ".SIPCommDoctorApplet/sip-communicator.xml"**));*
>
> *}*
>
> **
>
> *if** (oldContactlistFile**.exists())*
>
> *{*
>
> *oldContactlistFile.renameTo(new** File(userHome +
> ".SIPCommDoctorApplet/contactlist.xml"**));*
>
> *}*
>
> *}*
>
> **
>
> **
>
> *}*
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail:
users-unsubscribe@...
For additional commands, e-mail:
users-help@...