cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Failed to lookup BaseSite for BusinessProcess [forgottenPassword-home2019@gmail.com-1531153262830]. Unable to setup site in session.

Former Member
2,749

I'm geting the following error:

[AbstractProcessContextStrategy] Failed to lookup BaseSite for BusinessProcess [forgottenPassword-home2019@gmail.com-1531153262830]. Unable to setup site in session.

WARN [TaskExecutor-master-1978-ProcessTask [8798223106998]] [GenerateEmailAction] Could not resolve the content catalog version, cannot generate email content

any ideia what is the problem?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

this was a bug from hybris 6.6.

just add the following bean to your customcore-spring.xml

 <bean depends-on="processContextResolutionStrategyMap" parent="mapMergeDirective">
    <property name="key">
       <value type="java.lang.Class">de.hybris.platform.processengine.model.BusinessProcessModel</value>
    </property>
    <property name="value" ref="storeFrontProcessContextStrategy"/>
 </bean>
former_member645555
Discoverer
0 Likes

yes, you are right!

the problem happens here "DefaultProcessContextResolutionStrategy.java" "getStrategy" method when Hybris uses findeFirst

 getProcessStrategyMap().entrySet().stream().filter(e -> e.getKey().isAssignableFrom(businessProcessModel.getClass())).**findFirst()**.map(Map.Entry::getValue);
  }

you will get 2 strategies and the one that works is "storeFrontProcessContextStrategy" but I'm not sure if it is a good idea to force storeFrontProcessContextStrategy instead of BusinessProcessModel

Former Member
0 Likes

Thanks a lot

former_member704935
Discoverer
0 Likes

Thanks have solved my problem

Answers (4)

Answers (4)

Former Member
0 Likes

You can use this implementation in order to find the most specific/suitable class:

 @Override
 protected Optional<ProcessContextResolutionStrategy<BaseSiteModel>> getStrategy(BusinessProcessModel businessProcessModel)
 {
     Class<?> processClass = businessProcessModel.getClass();
     ProcessContextResolutionStrategy<BaseSiteModel> strategy = getProcessStrategyMap().get(processClass);
     if (strategy == null)
     {
         Class<?> bestClass = findMostSpecificClass(processClass);
         strategy = getProcessStrategyMap().get(bestClass);
     }
     return Optional.of(strategy);    
 }
     
 private Class<?> findMostSpecificClass(Class<?> processClass)
 {
     Class<?> mostSpecific = null;
     Set<Class<?>> supportedClasses = getProcessStrategyMap().keySet();
     for (Class<?> supportedClass : supportedClasses)
     {
         if (!supportedClass.isAssignableFrom(processClass))
         {
             continue;
         }
     
         if (mostSpecific == null || mostSpecific.isAssignableFrom(supportedClass))
         {
             mostSpecific = supportedClass;
         }
     }
     return mostSpecific;
 }
harshakaruturi
Explorer
0 Likes

Hi All,

I posted a detailed answer on the similar issue. Please visit the following link if you are interested more on this topic.

https://answers.sap.com/questions/12770693/failed-to-lookup-basesite-for-businessprocessunabl.html

Thanks,

Sriharsha K

former_member630758
Discoverer
0 Likes
 final ReportSizesWithoutStockModel reportFrontProcessModel = (ReportSizesWithoutStockModel) getBusinessProcessService()
                     .createProcess("reportSizesWithoutStockEmailProcess" + System.currentTimeMillis(),
                             "reportSizesWithoutStockEmailProcess");
             reportFrontProcessModel.getProcessDefinitionName();
             reportFrontProcessModel.setSite(baseSiteService.getCurrentBaseSite());
             reportFrontProcessModel.setStore(baseStoreService.getCurrentBaseStore());
             getModelService().save(reportFrontProcessModel);
             getBusinessProcessService().startProcess(reportFrontProcessModel);

I have the same problem with this lines.

Regards,

César.

Former Member
0 Likes

Hi Vitor

You need to set current site in the process.

StoreFrontCustomerProcessModel forgotEmailProcess = businessProcessService .createProcess("forgotEmailProcess-" + System.currentTimeMillis(), "forgotEmailProcess");

         forgotEmailProcess .setSite(site);
         forgotEmailProcess .setLanguage(site.getDefaultLanguage());
         forgotEmailProcess .setStore(baseStore);
         modelService.save(forgotEmailProcess );
         businessProcessService.startProcess(forgotEmailProcess );

Regards,

Yashwanth

Former Member
0 Likes

Thanks , but that was not the problem.