Not able to call sling service from component jsp
Hi All,
I have created a component jsp ,from which i need to call a sling service,this component page simply calls the methods of service.When i am trying to see the rendered page i am getting null pointer exception.
Can someone tell me what could be the reason,why could not instantiate the service.
Attaching jsp and service class.
<%@include file="/libs/foundation/global.jsp"%>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %>
<%@page import="com.sample.initiatewf.InvokeAEMWorkflow"%>
<h1>TemplatePDF Page</h1>
<%
//create a InvokeAEMWorkflow instance
com.sample.initiatewf.InvokeAEMWorkflow wfService = sling.getService(com.sample.initiatewf.InvokeAEMWorkflow.class);
%>
<h2>About to invoke an AEM workflow using the AEM workflow APIs</h2>
<h3><%=wfService.getStringMsg()%></h3>
Thanks,
Kishore