我创建了一个组件,该组件在Cq5中使用了OSGI bundle 包中的吊索服务。
但是在使用时会抛出错误,指出 com.aem.HelloService无法解析为类型,
当在http://localhost:4502/system/console/services下看时。
服务运行正常。
最佳答案
在您的Web控制台中查找OSGI bundle 包,例如:
http://localhost:4502/system/console/bundles
然后在包的属性下查找名为 Symbolic Name 的属性。参见以下示例:
这是在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/