【问题标题】:Getting Service cannot be resolved to a type error while consuming OSGi service使用 OSGi 服务时获取服务无法解析为类型错误
【发布时间】:2016-09-01 06:29:09
【问题描述】:

我创建了一个组件,它使用 Cq5 中 OSGI 捆绑包中的 sling 服务。 但是在使用它时会抛出错误,指出 com.aem.HelloService 无法解析为类型, 在http://localhost:4502/system/console/services 下查看时。

服务运行正常。

【问题讨论】:

  • 请提供一些代码 sn-p,显示您尝试访问该服务的方式。

标签: compiler-errors adobe aem osgi-bundle


【解决方案1】:

在您的网络控制台中查找您的 OSGI 包,例如,可以在以下位置找到:

http://localhost:4502/system/console/bundles

然后在你的包的属性下查找名为符号名称的属性。示例如下:

这是您在 JSP 导入中必须使用的路径,例如,在 JSP 页面的顶部:

<%@page import="org.apache.sling.tooling.support.install%> //you might have to add .* at the end to import everything

然后还要确保您的 OSGI 服务 Java 文件按照 Adob​​e 和其他文档正确注释和构造

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-31
    • 2022-11-22
    • 1970-01-01
    • 2023-03-24
    • 2017-03-28
    • 2012-05-11
    • 1970-01-01
    • 2023-01-30
    相关资源
    最近更新 更多