Adding new custom rest template (starterstore-2.0.0)

#1

Hi,

We are trying to add custom rest template. Could you please brief about configuration to add custom rest template. We have followed https://documentation.bloomreach.com/library/concepts/crisp-api/configuring-crisp-addon.html please find the below error which we are facing while replacing “SimpleJacksonRestTemplateResourceResolver” with custom template “BCSimpleJacksonRestTemplateResourceResolver”.

[INFO] [talledLocalContainer] 14.05.2019 14:14:01 WARN ResourceResolversInitializingThread [AbstractApplicationContext.refresh:557] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver] for bean with name ‘com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver#0’; nested exception is java.lang.ClassNotFoundException: com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver
[INFO] [talledLocalContainer] 14.05.2019 14:14:01 ERROR ResourceResolversInitializingThread [RepositoryMapResourceResolverProvider.refreshResourceResolvers:271] Failed to load child context for resource space, ‘bigcommerce’.
[INFO] [talledLocalContainer] org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver] for bean with name ‘com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver#0’; nested exception is java.lang.ClassNotFoundException: com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1392) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:680) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:647) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1518) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1023) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:829) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
[INFO] [talledLocalContainer] at org.onehippo.cms7.crisp.core.resource.RepositoryMapResourceResolverProvider.createChildApplicationContext(RepositoryMapResourceResolverProvider.java:339) ~[hippo-addon-crisp-core-13.1.0.jar:13.1.0]
[INFO] [talledLocalContainer] at org.onehippo.cms7.crisp.core.resource.RepositoryMapResourceResolverProvider.refreshResourceResolvers(RepositoryMapResourceResolverProvider.java:261) [hippo-addon-crisp-core-13.1.0.jar:13.1.0]
[INFO] [talledLocalContainer] at org.onehippo.cms7.crisp.core.resource.RepositoryMapResourceResolverProvider$ResourceResolversInitializingThread.run(RepositoryMapResourceResolverProvider.java:390) [hippo-addon-crisp-core-13.1.0.jar:13.1.0]
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver

Regards,
Arun

#2

java.lang.ClassNotFoundException:

com.bloomreach.commercedxp.resolver.BCSimpleJacksonRestTemplateResourceResolver

You should deploy your class

#3

Hi machak

Its configured as beandefinition of “bigcommerce” resource space property under crispregistry (same way SimpleJacksonRestTemplateResourceResolver was configured ) , So is there some place else I need to configure.

Regards
Arun

#4
<?xml version="1.0" encoding="UTF-8"?>













http://www.example.com/products/current/sku/unknown/overview.html




















#5

Hi,
it could also depend on which package/module you used to define that class. Probably your custom resource resolver must be defined in the cms module. Could you please check this?

1 Like
#6

Thank you giacomolm. It’s working fine after defining in cms module previously i have defined in site module. Any knowledge material to decide package/module.

Regards,
Arun

#7

Hi Arun, IMHO this is mostly related to the Bloomreach XM deployment strategy, since multiple class-loaders may be involved. I would suggest to have a look at this documentation page [1], to have a better understanding of how things (like the CRISP add-on) work under the hood.

HTH

[1] https://documentation.bloomreach.com/library/deployment/deploy-a-project-distribution.html

1 Like
#8

Thanks much giacomolm.