嵌入式菲利克斯,Android的应用程序着决心org.osgi.framework内运行 [英] Embedded Felix, running inside android-app cant resolve org.osgi.framework

查看:221
本文介绍了嵌入式菲利克斯,Android的应用程序着决心org.osgi.framework内运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚,为什么会发生以下情况:

i cant figure out why the following happens:

我正在从一个小小的Andr​​oid应用程序的嵌入式的Apache费利克斯。我在开始后的框架编程方式安装2束,但双方从未进入解决状态。从而捆绑MyBundle1进口MyBundle2。

I am running an embedded apache felix from a small android application. I programmatically install 2 bundles after starting the framework, but both never enter the "resolved" state. Thereby the Bundle "MyBundle1" imports "MyBundle2".

这是什么logcat的告诉我:

This is what Logcat tells me:

05-17 20:21:56.514: ERROR/MainActivity(384): org.osgi.framework.BundleException:    
Unresolved constraint in bundle de.xy.MyBundle1 [1]: Unable to resolve 1.11: missing   
requirement [1.11] package; (package=de.xy.MyBundle2) [caused by: Unable to resolve 2.0: 
missing requirement [2.0] package; (&(package=org.osgi.framework)(version>=1.5.0))]     

我完全理解错误消息说的话(嗯... org.osgi.framework在1.5+版本不能得到解决),但我无法弄清楚为什么会这样。为什么不能框架决心自己?我试着运行相同的felix.jar与亚行的shell独立的,两者捆绑工作。 Ofcourse,该felix.jar是最新的(3.2)

I totally understand what the error-message says (well...org.osgi.framework in version 1.5+ cant be resolved) but i cant figure out why this happens. Why cant the framework resolve "himself"?! I tried to run the same felix.jar as standalone with the adb shell , and both bundles work. Ofcourse, the felix.jar is up to date (3.2)

谢谢你的建议!

丹尼尔

FelixSetup

FelixSetup

    m_configMap = new StringMap(false);
    try {
        m_cache = File.createTempFile("felix-cache", null);
    } catch (IOException ex) {
        throw new IllegalStateException(ex);
    }
    m_cache.delete();
    boolean mkdirs = m_cache.mkdirs();  // works (=true)
    m_activator = new HostActivator();  // implements BundleActivator 
    List list = new ArrayList();
    list.add(m_activator);
    m_configMap.put(FelixConstants.LOG_LEVEL_PROP, "1");
    m_configMap.put(BundleCache.CACHE_ROOTDIR_PROP, ".");
    m_configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list);
    m_configMap.put(FelixConstants.FRAMEWORK_STORAGE, m_cache.getAbsolutePath()); 
    m_felix = new Felix(m_configMap);
    try {
        m_felix.start();
    } catch (BundleException ex) {
        Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
    }

我不知道有没有事做与previous问题:

I dont know if it has something to do with the previous problems:

05-18 08:52:59.149: VERBOSE/out(363): Problem creating boot delegation class loader:      java.lang.reflect.InvocationTargetException
05-18 08:52:59.209: VERBOSE/out(363): ERROR: Error parsing system bundle export statement:  (java.lang.IllegalArgumentException:A header cannot be an empty string.)

05-18 08:52:59.209: VERBOSE/out(363): java.lang.IllegalArgumentException: A header cannot be an empty string.

我安装和

myBundle1= bundleContext.installBundle("file:/data/felix/MyBundle1.jar"); 
myBundle2= bundleContext.installBundle("file:/data/felix/MyBundle2.jar"); 

myBundle1.start();

他们被previously dx'ed并移动到/数据/菲利克斯用的亚行推

同样的code我在Android应用中使用也适用常规的Java控制台应用程序内。

The same code I used in the android-application also works inside a regular java console-app.

推荐答案

在构建框架的方法看起来不错给我。你可以考虑

The way you build up the framework looks okay to me. You could consider


  • 替换 FRAMEWORK_SYSTEMPACKAGES 由特定于Android,列表,如果你的包将如使用可活动),或

  • 不使用临时文件,而是指向了一些你知道存在目录。

  • replacing the FRAMEWORK_SYSTEMPACKAGES by a list that is specific for Android, if your bundles will e.g. be using Activities), or
  • not using a temp file, but point to some directory you know exists.

我们已经在过去使用3.0.1成功,而我有你张贴的错误信息有什么用它做的想法。你可以尝试该版本的菲利克斯,以及其是否正常工作,你可能已经发现,在菲利克斯回归,然后你就可以到users@felix.apache.org汇报。

We have used 3.0.1 in the past successfully, and I do have the idea that the error message you posted has something to do with it. You could try that version of Felix, and if that works, you may have found a regression in Felix, which you can then report to users@felix.apache.org .

这篇关于嵌入式菲利克斯,Android的应用程序着决心org.osgi.framework内运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆