添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
耍酷的移动电源  ·  2021年ISTIC-CLARIVATE ...·  4 周前    · 
踢足球的鼠标  ·  布朗运动·  6 月前    · 
千年单身的红薯  ·  「评测」 ...·  1 年前    · 

Hello everyone,

During hybris initialization by ant initialize a ClassCastException is thrown and it is getting init process stuck.

The hybris version we are using is 6.6.0.0 . This exception is thrown randomly, so the next time I start init the process can continue with no issues. This exception is thrown on different local workstation as well as on the server instances. The database is not an issue as well since it is reproducible on MySQL, SAP Hana, HSQLD.

Currently we just want to customize RemoveDataOnSetURLPrepareInterceptor , but I am curious if someone know the root cause of this issue?

 [java] [m de.hybris.platform.servicelayer.exceptions.ModelSavingException: [de.hybris.platform.media.interceptors.RemoveDataOnSetURLPrepareInterceptor@41945ff2]: unexpected preparer error: Cannot cast class de.hybris.platform.core.model.audit.AuditReportConfigModel to class de.hybris.platform.core.model.media.MediaModel
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.invokePrepareInterceptors(ModelWrapper.java:279) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.executeInterceptorsAndCascade(ModelWrapper.java:108) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultModelExtractor.process(DefaultModelExtractor.java:44) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.performPersistenceOperations(DefaultModelService.java:720) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAllInternal(DefaultModelService.java:715) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:695) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.save(DefaultModelService.java:643) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.audit.internal.config.DefaultAuditConfigService.storeConfiguration(DefaultAuditConfigService.java:137) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.audit.internal.config.DefaultAuditConfigService.storeConfiguration(DefaultAuditConfigService.java:125) ~[coreserver.jar:?]
      [java]     at java.util.HashMap$Values.forEach(HashMap.java:981) ~[?:1.8.0_152]
      [java]     at de.hybris.platform.audit.internal.config.DefaultAuditConfigService.storeConfigurations(DefaultAuditConfigService.java:101) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization.storeGenericAuditConfigurations(Initialization.java:1008) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization.doInitializeImpl(Initialization.java:569) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization.access$5(Initialization.java:466) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization$5.call(Initialization.java:787) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization$5.call(Initialization.java:1) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.system.InitializationLockHandler.performLocked(InitializationLockHandler.java:80) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.core.Initialization.doInitialize(Initialization.java:819) ~[coreserver.jar:?]
      [java]     at de.hybris.ant.taskdefs.InitPlatformAntPerformableImpl.performImpl(InitPlatformAntPerformableImpl.java:106) ~[coreserver.jar:?]
      [java]     at de.hybris.ant.taskdefs.AbstractAntPerformable.doPerform(AbstractAntPerformable.java:92) [coreserver.jar:?]
      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
      [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
      [java]     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
      [java]     at bsh.Reflect.invokeMethod(Reflect.java:134) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.Reflect.invokeObjectMethod(Reflect.java:80) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.Name.invokeMethod(Name.java:858) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.Interpreter.eval(Interpreter.java:645) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.Interpreter.eval(Interpreter.java:739) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at bsh.Interpreter.eval(Interpreter.java:728) [bsh-2.0b5.jar:2.0b5 2005-06-12 04:50:41]
      [java]     at de.hybris.platform.util.ClientExecuter.execute(ClientExecuter.java:49) [coreserver.jar:?]
      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
      [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
      [java]     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
      [java]     at de.hybris.bootstrap.loader.Loader.execute(Loader.java:142) [ybootstrap.jar:?]
      [java]     at de.hybris.bootstrap.loader.Loader.main(Loader.java:118) [ybootstrap.jar:?]
      [java] Caused by: java.lang.ClassCastException: Cannot cast class de.hybris.platform.core.model.audit.AuditReportConfigModel to class de.hybris.platform.core.model.media.MediaModel
      [java]     at de.hybris.platform.media.interceptors.RemoveDataOnSetURLPrepareInterceptor.onPrepare(RemoveDataOnSetURLPrepareInterceptor.java:1) ~[coreserver.jar:?]
      [java]     at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.invokePrepareInterceptors(ModelWrapper.java:270) ~[coreserver.jar:?]
      [java]     ... 39 more
      [java] Caused by: Sourced file: inline evaluation of: ``de.hybris.ant.taskdefs.AntPerformable p = new de.hybris.ant.taskdefs.InitPlatfor . . . '' : Method Invocation p.doPerform : at Line: 2 : in file: inline evaluation of: ``de.hybris.ant.taskdefs.AntPerformable p = new de.hybris.ant.taskdefs.InitPlatfor . . . '' : p .doPerform ( ) 
      [java] 
      [java] Target exception: de.hybris.platform.servicelayer.exceptions.ModelSavingException: [de.hybris.platform.media.interceptors.RemoveDataOnSetURLPrepareInterceptor@41945ff2]: unexpected preparer error: Cannot cast class de.hybris.platform.core.model.audit.AuditReportConfigModel to class de.hybris.platform.core.model.media.MediaModel
      [java] 
      [java]     at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:97)
      [java]     at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
      [java]     at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
      [java]     at bsh.Interpreter.eval(Interpreter.java:645)
      [java]     at bsh.Interpreter.eval(Interpreter.java:739)
      [java]     at bsh.Interpreter.eval(Interpreter.java:728)
      [java]     at de.hybris.platform.util.ClientExecuter.execute(ClientExecuter.java:49)
      [java]     ... 6 more
						

Hello Vijaya,

Yes, we have fixed an issue by replacing OOTB RemoveDataOnSetURLPrepareInterceptor by our CustomRemoveDataOnSetURLPrepareInterceptor.

In the CustomRemoveDataOnSetURLPrepareInterceptor:

 public void onPrepare(ItemModel item, InterceptorContext ctx) {
      if (item instanceof MediaModel) {
						

Can you confirm that the issue appeared while developing on 6.6.x or only when switching from 6.6.x to 6.7.x?

Also: did the error show in a platform only / limited setup or only when you included accelerators?

This would definitely help getting to the root cause.

Thank you

In case you wondered, the issue is still present on the latest Hybris version (18.08).

It will be fixed in the next release, scheduled for November(18.11). Until then, we'll need to stick with the fix :)!

Regards.

Hi all, I'm also facing the issue on a fresh 6.7.0 (upgrading from 6.6.0) when initializing the system .

Cannot cast class de.hybris.platform.core.model.audit.AuditReportConfigModel to class de.hybris.platform.core.model.media.MediaModel

This doesn't always occur, but the initialization exits after this error leaving the database in an inconsistent state.

The RemoveDataOnSetURLPrepareInterceptor is mapped as a Prepare Intercerptor for Media items (see media-spring.xml), but clearly a AuditReportConfigModel instance IS NOT a Media; it extends AbstractDynamicContentModel which itself directly extends ItemModel.

So, I'm pretty sure that this is an out-of-the-box bug.

As there doesn't seem the be a way to deactivate this audit report saving, I'm going to (reluctantly) implement the workaround check mentioned by .

Regards.

Hi Andreas, You indeed did a great job of actually going through the investigation! The good news is that you have tracked down the probable root cause and confirmed the issue. The bad news is that a corrupt type system cache seems to me like a serious bug; hopefully we'll get this fixed soon.

Thanks! How to create and run unit test in SAP Commerce Cloud in CRM and CX Blogs by SAP Error Sap commerce hybris 2211: sapjco3.dll: Can't find dependent libraries in CRM and CX Questions SAP Commerce Cloud - DB Sync data migration safeguarding in CRM and CX Blogs by SAP How to update the CollectionType in database if it was changed from "collection" to "set". in CRM and CX Questions System Update Failing in CRM and CX Questions