Hello

I wrote a very simple POJO, built it as OSGi bundle and deployed it to Sling11. Here's the source:

package rome.testly.testly1;
import org.osgi.service.component.annotations.Component;

@Component(service=SlingFutil.class )
public class SlingFutil {

    public String nonsense() {
        return "This is nonsense";
    }
}

The component/service appears on the Felix console:

symbolic Name   testly1
Version         0.0.1.202003271754
Bundle Location         /home/juerg/eclipse-workspace/testly1/target/classes
Last Modification       Fri Mar 27 18:54:01 CET 2020
Start Level     20
Exported Packages       ---
Imported Packages org.osgi.framework,version=1.9.0 from org.apache.felix.framework (0) <http://localhost:8080/system/console/bundles/0> org.osgi.service.component,version=1.4.0 from org.apache.felix.scr (50) <http://localhost:8080/system/console/bundles/50> org.slf4j,version=1.7.25 from slf4j.api (20) <http://localhost:8080/system/console/bundles/20> Service ID 477 <http://localhost:8080/system/console/services/477> Types: java.lang.Runnable
Component Name: rome.testly.testly1.SimpleDSComponent
Component ID: 323
Service ID 478 <http://localhost:8080/system/console/services/478> Types: rome.testly.testly1.SlingFutil
Component Name: rome.testly.testly1.SlingFutil
Component ID: 324



Now I try to call SlingFutil.nonsense() from a JSP:

...
<%@ page import="javax.jcr.*,
        org.apache.sling.api.resource.Resource,
        rome.testly.testly1.*"
%>
...
<%
SlingFutil some = new SlingFutil();
%>
...

At this point, the JSP compiler complains that the type (SlingFutil) is unknown.
I also tried

sling.getService(rome.testly.testly1.SlingFutil.class);

instead, but the result is the same.

This used to work well at BND times of Sling, so I don't know what's wrong with this R7 code.

Thanks,
Juerg

Reply via email to