Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

using sling service to get wokflowservice in jsp fails for AEM 5.6.1

Avatar

Level 4

 Hi,
 
 I am AEM  5.6.1 version
 
 I have used the below code and see that it fails while building in my ecllispe.Could you please let me know who this could be solved
 
 <%@include file="/libs/foundation/global.jsp"%>
 
 <%
  try {
         com.day.cq.workflow.WorkflowService workflowService = sling.getService(com.day.cq.workflow.WorkflowService.class);
        
    } catch (Exception e) {
        log.error(e.getMessage(), e);

 %>
 
 
 An error occurred at line: 1 in the generated java file
[ERROR] The type com.day.cq.workflow.WorkflowService cannot be resolved. It is indirectly referenced from required .class files
[ERROR] com.day.cq.workflow.WorkflowService cannot be resolved to a type

3 Replies

Avatar

Level 7

Hi,

 

Make sure you have the below dependency added.

 

<dependency><groupId>com.day.cq.workflow</groupId><artifactId>cq-workflow-api</artifactId><version>5.4.2</version></dependency>

 

Thanks

Tuhin

Avatar

Level 4

Hi,

 

I have added 

<dependency>
                <groupId>com.day.cq.workflow</groupId>
                <artifactId>cq-workflow-api</artifactId>
                <version>5.6.2</version>
                <scope>provided</scope>
            </dependency>

But still getting the error

 

Thanks.

Avatar

Level 9

The Issue is not in project build compilation which could be resolved by adding a dependency. it is happening when a particular server isn't available.

Check the service "com.day.cq.workflow.WorkflowService" in http://localhost:4502/system/console/services.

Regards,

Jitendra