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

迁移到AEM 6.3后,AEM servlet配置工厂丢失

  •  0
  • Ashley  · 技术社区  · 8 年前

    我在AEM 6.0中使用了ACS commons,但在6.3中,/system/console/configMgr中缺少工厂。我将代码与当前的ACS站点地图进行了比较,注释是相同的。

    @Component(metatype = true,  
            label = "Apple SEO Site Map Servlet",  
            description = "SEO Site Map Servlet",  
            configurationFactory = true,  
            policy = ConfigurationPolicy.REQUIRE)  
    @Service  
    @SuppressWarnings("serial")  
    @Properties({@Property(name = "sling.servlet.resourceTypes", unbounded = PropertyUnbounded.ARRAY,  
            label = "Sling Resource Type", description = "Sling Resource Type for the Home Page component or components."),  
            @Property(name = "sling.servlet.selectors", value = "search-engine-sitemap", propertyPrivate = true),  
            @Property(name = "sling.servlet.extensions", value = "xml", propertyPrivate = true),  
            @Property(name = "sling.servlet.methods", value = "GET", propertyPrivate = true),  
            @Property(name = "webconsole.configurationFactory.nameHint",  
                    value = "Site Map on resource types: [{sling.servlet.resourceTypes}]")})
    
    1 回复  |  直到 8 年前
        1
  •  1
  •   Sharath Madappa    8 年前

    根据上面评论中的讨论,问题在于设置maven插件来生成scr描述符,而不是注释本身的使用。

    有关这些注释如何工作的其他一些信息:

    • 在创建包以生成xml文件时,实际上会处理注释。OSGI容器中使用的是生成的XML输出。如果您有理由相信所使用的注释是正确的,那么请验证生成的xml。

    • 在AEM 6.3之前,一般做法是将felix scr注释与maven scr插件结合使用。由于6.3可以使用官方OSGI包中的注释,这是在R6中添加的,因此不推荐使用felix注释。您不再需要maven scr插件,maven bundle插件将处理OSGI R6注释。

    • 由于容器使用的是xml,因此没有理由从<6.3停止6.3上的工作。如果存在问题,通常在生成设置中。

    • 生成的scr描述可以在工作区目标/类/OSGI-INF的以下位置找到;目标/类/META-INF。

    • 如果使用OSGI R6注释和maven bundle插件,但看不到生成的xml文件,请添加 <exportScr>true</exportScr> 到POM中插件配置的配置部分。从版本12起,Adobe archetype生成的POM将跳过此设置

    推荐文章