OSGi包已在Felix中安装并处于活动状态,但没有期望或可见的输出

时间:2015-07-29 12:46:11

标签: apache osgi

我是OSGi世界的新手。 我使用Felix 5.0.1作为OSGi容器和Apache Aries Blueprint捆绑集。 Maven 3.2.1,Eclipse版本:作为IDE的Juno Service Release 2。 Windows 7专业版操作系统。

我使用OSGi包开发了两个小应用程序。

  1. 欢迎申请,它有3个捆绑

    • welcomeapi bundle
    • welcomeserver bundle
    • welcomeclient bundle

    api包有接口,服务器包正在实现接口并暴露服务。

    客户端软件包引用/使用服务器软件包公开的软件包。

    此应用程序运行正常,并且希望系统输出正在Felix命令提示符

  2. 上正确显示
  3. 联系申请

    此应用程序还有3个包

    • ContactAPI
    • 的ContactDAO
    • ContactHellowWorld

    在这个应用程序中,我做了一些额外的事情,如下所示。

    • ContactAPI

      bundle有一个接口和一个类。 (并没有任何config.xml)

    • ContactDAO:

      此捆绑包具有API /方法,将Contactid作为输入参数,连接到数据库并获取所需的数据,如fname,lname等。 并向请求者提供这些联系方式(即ContactHelloWorld包)。

    • ContactHellowWorld

      bundle有API /方法,它们将Contactid作为ContactDAO方法的输入参数提供,并且应该获取联系对象并在控制台上打印值。

    简而言之,ContactHelloworld包调用ContactDAO项目API /方法 contactDAO.getContactList(); contactDAO.getContact(101);

  4. 所有三个Contact应用程序包都已安装并处于活动状态但没有输出

           42|Installed  |    1|ContactAPI (0.0.1.SNAPSHOT)
           43|Installed  |    1|ContactDAO (0.0.1.SNAPSHOT)
           44|Installed  |    1|ContactHelloWorld (0.0.1.SNAPSHOT)
        g! start 42
        DEBUG: WIRE: [Contact_API [42](R 42.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.7)) -> [org.apache.felix.framework [0](R 0)]
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_API
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_API.
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_API
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_API.
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Scanning bundle Contact_API for blueprint application
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - No blueprint application found in bundle Contact_API
        g! [FelixDispatchQueue] DEBUG Contact_API - BundleEvent RESOLVED
        [FelixDispatchQueue] DEBUG Contact_API - BundleEvent STARTED
        start 43
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.wiring.package; (osgi.wiring.package=javax.sql) -> [org.apache.felix.framework [0](R 0)]
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.wiring.package; (osgi.wiring.package=javax.management) -> [org.apache.felix.framework [0](R 0)]
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.1.0)(!(version>=3.0.0))) -> [org.apache.commons.dbcp2 [9](R 9.0)]
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.wiring.package; (&(osgi.wiring.package=com.javapro.gokul.sample.osgi.spring.contact)(version>=0.0.0)(!(version>=1.0.0))) -> [Contact_API [42](R 42.0)]
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.wiring.package; (&(osgi.wiring.package=com.javapro.gokul.sample.osgi.spring.contactapi)(version>=0.0.0)(!(version>=1.0.0))) -> [Contact_API [42](R 42.0
        ]
        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.7)) -> [org.apache.felix.framework [0](R 0)]
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_DAO
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_DAO.
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_DAO
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_DAO.
        [FelixDispatchQueue] DEBUG Contact_DAO - BundleEvent RESOLVED
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Scanning bundle Contact_DAO for blueprint application
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - No blueprint application found in bundle Contact_DAO
        g! [FelixDispatchQueue] DEBUG Contact_DAO - BundleEvent STARTED
        start 44
        DEBUG: WIRE: [Contact_Hello_World [44](R 44.0)] osgi.wiring.package; (&(osgi.wiring.package=com.javapro.gokul.sample.osgi.spring.contactapi)(version>=0.0.0)(!(version>=1.0.0))) -> [Contact_API [42
        (R 42.0)]
        DEBUG: WIRE: [Contact_Hello_World [44](R 44.0)] osgi.wiring.package; (&(osgi.wiring.package=com.javapro.gokul.sample.osgi.spring.impl)(version>=0.0.0)(!(version>=1.0.0))) -> [Contact_DAO [43](R 43
        0)]
        DEBUG: WIRE: [Contact_Hello_World [44](R 44.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.7)) -> [org.apache.felix.framework [0](R 0)]
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_Hello_World
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_Hello_World.
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Starting BlueprintContainer destruction process for bundle Contact_Hello_World
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Not a blueprint bundle or destruction of BlueprintContainer already finished for Contact_Hello_World.
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - Scanning bundle Contact_Hello_World for blueprint application
        [Gogo shell] DEBUG org.apache.aries.blueprint.container.BlueprintExtender - No blueprint application found in bundle Contact_Hello_World
        g! [FelixDispatchQueue] DEBUG Contact_Hello_World - BundleEvent RESOLVED
        [FelixDispatchQueue] DEBUG Contact_Hello_World - BundleEvent STARTED
    

    在Felix控制台上获取以下日志语句(日志级别设置为4)

        DEBUG: WIRE: [Contact_DAO [43](R 43.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.7)) -> [org.apache.felix.framework [0](R 0)]  
    

    但是为什么我在欢迎申请中没有得到同样的问题?

    请查看随附的代码。 任何帮助将不胜感激。

    One more important point I have to mentioned 
    I observed that the services for the Contact application are not getting registered. (Even though Contact Application bundles are Active)
    
       41|Active     |    1|spring-osgi-io (1.2.1)
       42|Active     |    1|WelcomeApi (0.0.1.SNAPSHOT)
       43|Active     |    1|WelcomeServer (0.0.1.SNAPSHOT)
       44|Active     |    1|WelcomeClient (0.0.1.SNAPSHOT)
    g! inspect cap service 42
    WelcomeServer [42] provides:
    ----------------------------
    service [EMPTY]
    g! inspect cap service 43
    Welcome_Server [43] provides:
    -----------------------------
    service; com.javapro.gokul.apache.aries.blueprint.welcomeapi.WelcomeService with properties:
       osgi.service.blueprint.compname = welcomeservice
       service.bundleid = 43
       service.id = 37
       service.scope = bundle
       Used by:
          Welcome_Client [44]
    service; org.osgi.service.blueprint.container.BlueprintContainer with properties:
       osgi.blueprint.container.symbolicname = Welcome_Server
       osgi.blueprint.container.version = 0.0.1.SNAPSHOT
       service.bundleid = 43
       service.id = 38
       service.scope = singleton
    g! inspect cap service 44
    Welcome_Client [44] provides:
    -----------------------------
    service; org.osgi.service.blueprint.container.BlueprintContainer with properties:
       osgi.blueprint.container.symbolicname = Welcome_Client
       osgi.blueprint.container.version = 0.0.1.SNAPSHOT
       service.bundleid = 44
       service.id = 39
       service.scope = singleton
    g!
    ======================================================================================================================================================
    Above Services for Welcome application are registered propely 
    ======================================================================================================================================================
    Below Services for Contact application are NOT registered propely 
    ======================================================================================================================================================
       42|Active     |    1|WelcomeApi (0.0.1.SNAPSHOT)
       43|Active     |    1|WelcomeServer (0.0.1.SNAPSHOT)
       44|Active     |    1|WelcomeClient (0.0.1.SNAPSHOT)
       45|Active     |    1|ContactAPI (0.0.1.SNAPSHOT)
       46|Active     |    1|ContactDAO (0.0.1.SNAPSHOT)
       47|Active     |    1|ContactHelloWorld (0.0.1.SNAPSHOT)
    g! inspect cap service 45
    Contact_API [45] provides:
    --------------------------
    service [EMPTY]
    g! inspect cap service 46
    Contact_DAO [46] provides:
    --------------------------
    service [EMPTY]
    g! inspect cap service 47
    Contact_Hello_World [47] provides:
    ----------------------------------
    service [EMPTY]
    g!
    

0 个答案:

没有答案