compiler-errors - 使用OSGi服务时无法将获取服务解析为类型错误

标签 compiler-errors adobe aem osgi-bundle

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

服务运行正常。

最佳答案

在您的Web控制台中查找OSGI bundle 包,例如:

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

然后在包的属性下查找名为 Symbolic Name 的属性。参见以下示例:enter image description here

这是在JSP导入中必须使用的路径,例如,在JSP页面的顶部:
<%@page import="org.apache.sling.tooling.support.install%> //you might have to add .* at the end to import everything

然后还要确保按照Adobe和其他文档正确注释和构造了OSGI服务Java文件。

关于compiler-errors - 使用OSGi服务时无法将获取服务解析为类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39264133/

相关文章:

C++ 错误 : Class has-a-relationship with Struct in Same Header File

ios - 编译项目时出现 Xcode 错误

c++ - 尝试实现观察者模式时出现多个编译器错误

javascript - Adobe PDF Javascript 提取名称,保存文件

java - 将 xml 文件上传到 AEM DAM

javascript - CQ5 AEM : how to get a component by name within a dialog using javascript

go - 在 golang 中关于 'for' 语法的编译错误描述中是否使用了不正确的术语?

Adobe LiveCycle 中单选按钮的 Javascript

java - 如何获取自定义元数据属性的值

maven - aem-api 和 uber-jar 之间的区别?