代码之家  ›  专栏  ›  技术社区  ›  ImranRazaKhan

IPOJO组件未正确公开服务

  •  1
  • ImranRazaKhan  · 技术社区  · 6 年前

    我有ipojo组件

    @Component(immediate = true)
    @Provides
    public class MyComponent implements MyService
    {
    
    @Override
        public boolean islock()
        {
            return true;
        }
    
    }
    

    当我在卡拉夫部署时

    bundle:install -s mvn:com.my.osgi/mycomponent/0.0.1
    

    如果我做服务:在karaf控制台列表,它显示如下输出

    [org.apache.felix.ipojo.Factory] 
        -------------------------------- 
         component.class = com.my.osgi.mycomponent 
         component.description = factory name="com.my.osgi.mycomponent" 
    bundle="77" state="valid" implementation-class="com.my.osgi.mycomponent" 
                requiredhandlers list="[org.apache.felix.ipojo:properties, 
    org.apache.felix.ipojo:callback, org.apache.felix.ipojo:provides, 
    org.apache.felix.ipojo:architect 
        ure]" 
                missinghandlers list="[]" 
                provides specification="com.my.osgi.mycomponent" 
                inherited interfaces="[com.my.osgi.mycomponent]" 
    superclasses="[]" 
         component.providedServiceSpecifications = [com.my.osgi.mycomponent] 
         factory.name = com.my.osgi.mycomponent 
         factory.state = 1 
         service.bundleid = 77 
         service.id = 153 
         service.pid = com.my.osgi.mycomponent 
         service.scope = singleton 
    

    但我期望如下,

    [com.my.osgi.mycomponent] 
        ----------------------------------------------------- 
        instance.name = mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353 
         service.bundleid = 76 
         service.factoryPid = com.my.osgi.mycomponent 
         service.id = 397 
         service.pid = 
    com.my.osgi.mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353 
         service.scope = bundle 
    

    我做错什么了?我在和马文一起建房子。

    编辑: 在一个更大的应用程序中,当这个get deploy日志

    2018-07-17T12:03:50,011 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent REGISTERED - [org.apache.felix.ipojo.architecture.Architecture] - com.my.osgi.my-component
    2018-07-17T12:03:50,021 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent REGISTERED - [com.my.osgi.my-component]                         - com.my.osgi.my-component
    2018-07-17T12:03:50,021 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent MODIFIED -   [com.my.osgi.my-component]                         - com.my.osgi.my-component
    2018-07-17T12:03:50,021 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent MODIFIED -   [com.my.osgi.my-component]                         - com.my.osgi.my-component
    2018-07-17T12:03:50,021 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent MODIFIED -   [com.my.osgi.my-component]                         - com.my.osgi.my-component
    2018-07-17T12:03:50,021 | DEBUG | [iPOJO] pool-1-thread-1 | my-component | 38 - com.my.osgi.my-component  - 1.0.3 | ServiceEvent REGISTERED - [org.apache.felix.ipojo.Factory] - com.my.osgi.my-component
    

    但对我来说只有两行

    2018-07-17T11:45:43,624 | DEBUG | [iPOJO] pool-1-thread-1 | my-component  | 11 - com.my.osgi.my-component - 2.0.4.SNAPSHOT | ServiceEvent REGISTERED - [org.apache.felix.ipojo.extender.TypeDeclaration] - com.my.osgi.my-component
    2018-07-17T11:45:43,654 | DEBUG | [iPOJO] pool-1-thread-1 | my-component  | 11 - com.my.osgi.my-component - 2.0.4.SNAPSHOT | ServiceEvent REGISTERED - [org.apache.felix.ipojo.Factory] - com.my.osgi.my-component  
    

    那么这个架构在做什么,什么被修改了呢?

    推荐文章