I'm encountering an issue with integrating AEM and Salesforce | Community
Skip to main content
Level 2
February 21, 2024

I'm encountering an issue with integrating AEM and Salesforce

  • February 21, 2024
  • 8 replies
  • 3403 views
When I am creating aem user as leads with workflow, I get an "cannot be cast to class"
please see the error log in below,
 
21.02.2024 16:31:25.634 *ERROR* [JobHandler: /var/workflow/instances/server0/2024-02-21/salesforce-com-export_10:/home/users/we-retail/e4BozbZJR5ZClEhtA2QQ/profile] com.adobe.granite.workflow.core.job.JobHandler Error executing workflow step
com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:204) [com.adobe.granite.workflow.core:2.0.240.CQ660-B0017]
    at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:271) [com.adobe.granite.workflow.core:2.0.240.CQ660-B0017]
    at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502) [org.apache.sling.event:4.2.24]
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:351) [org.apache.sling.event:4.2.24]
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60) [org.apache.sling.event:4.2.24]
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:287) [org.apache.sling.event:4.2.24]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.adobe.granite.workflow.WorkflowException: Failed to execute process
    at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:108) [com.day.cq.workflow.cq-workflow-impl:6.3.8.CQ652-B0003]
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:194) [com.adobe.granite.workflow.core:2.0.240.CQ660-B0017]
    ... 8 common frames omitted
Caused by: java.lang.ClassCastException: class org.apache.jackrabbit.oak.plugins.value.jcr.ValueImpl cannot be cast to class java.lang.String (org.apache.jackrabbit.oak.plugins.value.jcr.ValueImpl is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @2e60ced2; java.lang.String is in module java.base of loader 'bootstrap')
    at com.adobe.cq.mcm.salesforce.SalesforceExportProcess.execute(SalesforceExportProcess.java:122)
    at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93) [com.day.cq.workflow.cq-workflow-impl:6.3.8.CQ652-B0003]
    ... 9 common frames omitted
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

8 replies

vk1-1Author
Level 2
February 23, 2024

Hi 
Anyone help me with the above issue?

 

Thank You 

Vk

narendragandhi
Community Advisor
Community Advisor
February 23, 2024

Hi @vk1-1 

 

It looks like you are running into a class cast exception while retrieving values from ValueImpl. Is it possible for you to share the code snippet for your custom workflow process class - SalesforceExportProcess.java to check this further?

 

Thanks

Narendra

vk1-1Author
Level 2
February 26, 2024

Hi @narendragandhi 

 

I am currently utilizing an in-built Salesforce workflow function and referring to the following document for guidance: Adobe Experience Manager Integration with Salesforce.

Please let me know if you need further assistance or clarification.

 

Thank You 
VK1

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 23, 2024

Hi, 


Please check this thread which explains why the error would happen: https://www.baeldung.com/java-classcastexception. Which leads me to think that something may be incompatible. How are you connecting the applications? I wrote a blog a couple of months ago about how to integrate Salesforce and AEM: https://www.oshyn.com/blog/aem-and-salesforce-integration , please check if that helps. 

Regards

 

Esteban Bustamante
vk1-1Author
Level 2
February 26, 2024

Hi @estebanbustamante,

 

Connectivity-wise, I have followed the same steps outlined in your blog. However, when attempting to create leads from AEM to Salesforce by workflow, I encounter a "cannot be cast to class" error 

 

Please let me know if you need further assistance or clarification. 

 

Thank You

VK1

 

 

vk1-1Author
Level 2
February 27, 2024

Hi 

 

Could someone please assist me with an issue I'm encountering? I'm unsure if it's related to AEM instance, and I'm currently using version 6.5.15 in my local setup

 

Thank You
VK1

narendragandhi
Community Advisor
Community Advisor
February 27, 2024

Hi @vk1-1 

 

Based on the error you shared above, the error is coming from the workflow process - SalesforceExportProcess.java class which is part of the Salesforce integration package so the Service Pack version may not be an issue.  It looks like you are following the steps from this article - https://experienceleague.adobe.com/docs/experience-manager-65/content/sites/administering/integration/salesforce.html

 

Can you please confirm if you are passing the user ID as shown in the article?

 

Thanks

Narendra

vk1-1Author
Level 2
February 28, 2024

Hi @narendragandhi 

 

Yes, I am passing the same userID as shown in the article.
Is there any other solution to resolve this issue? Are there any mistakes in the steps I followed in the article?

Could you please check logs screenshot below ?

 

Thank You,

VK1

kautuk_sahni
Community Manager
Community Manager
February 28, 2024

@vk1-1 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
kautuk_sahni
Community Manager
Community Manager
February 28, 2024

@vk1-1 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
vk1-1Author
Level 2
February 28, 2024

Hi @kautuk_sahni,

 

I have not found a solution for this one. could you please help me here?

 

Thank You 

VK1

vk1-1Author
Level 2
February 29, 2024

Hi 

 

Anyone have a solution for the above issue?

 

Thank You

VK1 

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 29, 2024

hey @vk1-1 

 

I don't think the issue is related to AEM or your instance because the error in the log you shared states this:

java.lang.ClassCastException: class org.apache.jackrabbit.oak.plugins.value.jcr.ValueImpl cannot be cast to class java.lang.String

In simpler terms, the program attempted to treat an object as a different type than it is. This often occurs when there's a misunderstanding about the type of data being handled or when incompatible types are used incorrectly.

To resolve this issue, you'll need to review the code where this casting occurs and ensure that it's handling the data correctly, possibly by using appropriate methods or conversions to work with the expected types

 

Are you manipulating a node/resource's properties somehow? You didn't post any code, but I think it will be fairly simple to understand where this is failing by debugging the execution of your code. Please follow this tutorial on how to do it:  https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-sdk/remote-debugging.html?lang=en

 

Hope this helps.

Esteban Bustamante
vk1-1Author
Level 2
February 29, 2024

Hi @estebanbustamante,

 

I am encountering an error in the Salesforce integration package, but I have not implemented any custom code related to this workflow. The error appears to be originating from the Salesforce integration package itself. 

 

Any updated or different Salesforce package for this one integration.

 

Please tell me if I followed any wrong steps from below document: https://experienceleague.adobe.com/docs/experience-manager-65/content/sites/administering/integration/salesforce.html

 

Thank You,

Vk1

 

 

vk1-1Author
Level 2
March 4, 2024

Hi 

 

Anyone have a solution for the above issue?

 

Thank You

VK1