You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Archetype 47创建AEM项目后OSGi Bundle无法激活问题

AEM Archetype 47项目OSGi Bundle无法激活问题解决

问题详情

使用Archetype 47创建的AEM项目,构建和部署流程都成功,但OSGi bundle始终无法进入Active状态,具体报错为:

  • com.day.cq.wcm.api,version=[1.31,2) 无法解析
  • org.apache.sling.api.request,version=[2.7,3) 无法解析

当前使用的Maven依赖配置:

<dependency>
    <artifactId>cq-wcm-api</artifactId>
    <version>5.14.6</version>
    <groupId>com.day.cq.wcm</groupId>
    <scope>provided</scope>
</dependency>

问题原因

  1. 依赖版本不匹配:Archetype 47对应AEM 6.5及以上版本,你使用的cq-wcm-api 5.14.6版本过低,其提供的API版本无法满足bundle运行时的版本要求。
  2. 缺失必要依赖:未添加sling-api相关依赖,导致org.apache.sling.api.request包无法被解析。

解决方法

1. 更新cq-wcm-api依赖版本

将cq-wcm-api替换为AEM 6.5兼容的高版本,示例配置:

<dependency>
    <groupId>com.day.cq.wcm</groupId>
    <artifactId>cq-wcm-api</artifactId>
    <version>6.5.19</version>
    <scope>provided</scope>
</dependency>

2. 添加sling-api依赖

补充缺失的sling-api依赖,确保版本符合[2.7,3)的要求,示例配置:

<dependency>
    <groupId>org.apache.sling</groupId>
    <artifactId>org.apache.sling.api</artifactId>
    <version>2.26.0</version>
    <scope>provided</scope>
</dependency>

3. 重新构建部署

执行以下Maven命令,重新构建并部署项目:

mvn clean install -PautoInstallPackage

4. 验证修复结果

登录AEM的OSGi控制台(路径:/system/console/bundles),检查目标bundle是否已切换为Active状态。

内容的提问来源于stack exchange,提问作者Siva_Veerla

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 13:20:55