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
Solved! Go to Solution.
Views
Replies
Total Likes
[img]service.png[/img]Kishore,
Your code required below change in jsp file
com.sample.initiatewf.InvokeAEMWorkflow wfService = sling.getService(com.sample.initiatewf.INvokeAEMWorkflowImp.class);
You were accessing your service with name "com.sample.initiatewf.INvokeAEMWorkflow.class" instead of "com.sample.initiatewf.INvokeAEMWorkflowImp.class"
Because you registered your service in INvokeAEMWorkflowImp class as below
@Service(value = {INvokeAEMWorkflowImp.class})
So it has to be accessed with INvokeAEMWorkflowImp.
Please see attached image for more clarification.
Regards
Brijesh
Views
Replies
Total Likes
[img]service.png[/img]Kishore,
Your code required below change in jsp file
com.sample.initiatewf.InvokeAEMWorkflow wfService = sling.getService(com.sample.initiatewf.INvokeAEMWorkflowImp.class);
You were accessing your service with name "com.sample.initiatewf.INvokeAEMWorkflow.class" instead of "com.sample.initiatewf.INvokeAEMWorkflowImp.class"
Because you registered your service in INvokeAEMWorkflowImp class as below
@Service(value = {INvokeAEMWorkflowImp.class})
So it has to be accessed with INvokeAEMWorkflowImp.
Please see attached image for more clarification.
Regards
Brijesh
Views
Replies
Total Likes
This is based on a community article. It looks like the OSGi bundle that contains the com.sample.initiatewf.InvokeAEMWorkflow service is not deployed and in an active state.
Make sure to deploy the OSGI bundle and place the bundle into an Active state as discussed here:
http://scottsdigitalcommunity.blogspot.ca/2013/09/creating-workflows-for-adobe-experience.html
Views
Replies
Total Likes
smacdonald2008 wrote...
This is based on a community article. It looks like the OSGi bundle that contains the com.sample.initiatewf.InvokeAEMWorkflow service is not deployed and in an active state.
Make sure to deploy the OSGI bundle and place the bundle into an Active state as discussed here:
http://scottsdigitalcommunity.blogspot.ca/2013/09/creating-workflows-for-adobe-experience.html
i am able to deploy bundle and it is also in active state but i am not able to refer the bundle from my component page.
Views
Replies
Total Likes
Views
Likes
Replies