Class cast exceptions and noclassdefexceptions from hst-platform api ( 12 to 13 upgrade)

Class cast exceptions in upgrade from 12 to 13 . no class def exceptions

pom dependency

org.onehippo.cms7.hst.components
hst-platform
provided

HstComponentConfigurationService configService =
((HstComponentConfigurationService) hstComponentWindow.getComponentInfo())

Changed pom depedency to

org.onehippo.cms7.hst.components
hst-platform
13.4.1-2

Then Class cast exceptions to same class

this is initial error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.hippoecm.hst.platform.container.site.CustomWebsiteHstSiteProviderServiceImpl#0’ defined in URL [jar:file:/Users/bkancharla/IdeaProjects/cmsdoms/target/tomcat9x/webapps/site/WEB-INF/lib/hst-platform-13.4.1.jar!/META-INF/hst-assembly/addon/org/hippoecm/hst/platform/SpringComponentManager-platform.xml]: Invocation of init method failed; nested exception is org.onehippo.cms7.services.HippoServiceException: A service of type org.hippoecm.hst.container.site.CustomWebsiteHstSiteProviderService is already registered.

HstComponentConfigurationService configService =
((HstComponentConfigurationService) hstComponentWindow.getComponentInfo())

this line is causing class cast exceptions for same class

Initially HstComponentConfigurationService under Hst-core (in bloomreach 12) but in 13 it moved to hst-platform package we started using that and causing issues

This implies that the class is being loaded from two different sources. Check your dependencies.

@bkancharla Were you able to resolve this? We are also seeing similar issue.