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

时间:2018-03-02 21:43:58

标签: servlets aem sling

我将ACS公共分区用于AEM 6.0,但在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 个答案:

答案 0 :(得分:1)

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

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

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

  • 在AEM 6.3之前,一般的做法是使用felix scr注释和maven-scr-plugin。从6.3开始,您可以使用官方OSGI包中的注释,这是在R6中添加的,因此不推荐使用felix注释。你不再需要maven-scr-plugin和maven-bundle-plugin来处理OSGI R6注释。

  • 由于它是容器使用的xml,因此没有理由从< 6.3停止处理6.3的服务声明。如果出现问题,通常是在构建设置中。

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

  • 如果您使用OSGI R6注释和maven-bundle-plugin并且没有看到生成的xml文件,请将<exportScr>true</exportScr>添加到POM中插件配置的配置部分。 Adobe原型生成的POM从版本12开始跳过此设置