Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

srinivasc110177
Level 4
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
Tuhin_Ghosh
Level 7
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

srinivasc110177
Level 4
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.

Jitendra_S_Toma
Level 9
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