Getting Service cannot be resolved to a type error while consuming OSGi service

时间:2016-09-01 06:29:09

标签: compiler-errors adobe cq5 aem osgi-bundle

I have created a component which consumes the sling service from OSGI bundle in Cq5. But while consuming it throws error stating that com.aem.HelloService cannot be resolved to a type , When looked under http://localhost:4502/system/console/services.

Service is running properly.

1 个答案:

答案 0 :(得分:1)

在您的webconsole中查找您的OSGI包,可以在以下位置找到:

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

然后在您的捆绑包的属性下查找名为符号名称的属性。请参阅下面的示例:
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文件