Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

I'm encountering an issue with integrating AEM and Salesforce

Avatar

Level 2
Level 2
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
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

17 Replies

Avatar

Level 2
Level 2

Hi 
Anyone help me with the above issue?

 

Thank You 

Vk

Avatar

Level 8

Hi @vk1 

 

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

Avatar

Level 2
Level 2

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

Avatar

Community Advisor

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

Avatar

Level 2
Level 2

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

 

 

Avatar

Level 2
Level 2

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

Avatar

Level 8

Hi @vk1 

 

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/integratio...

 

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

 

Thanks

Narendra

Avatar

Level 2
Level 2

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

Avatar

Administrator

@vk1 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

Avatar

Administrator

@vk1 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

Avatar

Level 2
Level 2

Hi @kautuk_sahni,

 

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

 

Thank You 

VK1

Avatar

Level 2
Level 2

Hi 

 

Anyone have a solution for the above issue?

 

Thank You

VK1 

Avatar

Community Advisor

hey @vk1 

 

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-a...

 

Hope this helps.



Esteban Bustamante

Avatar

Level 2
Level 2

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/integratio...

 

Thank You,

Vk1

 

 

Avatar

Community Advisor

As I mentioned in the blog, since this package uses classic UI and is old, it likely won't work properly in newer versions of AEM. That's the reason why I wrote the blog, so you can avoid depending on this package. If you really need this package to work, you can create a support case to get an official response from Adobe.

 

You can check out the following blog where Albin discusses other challenges related to this package: Integration of AEM/CQ5 with Salesforce Part 1. This may provide insights into updating the old code.

Reiterating, since I encountered some of those same issues (and more), I created a new way to integrate with Salesforce.

 

Hope this helps



Esteban Bustamante

Avatar

Level 2
Level 2

Hi 

 

Anyone have a solution for the above issue?

 

Thank You

VK1