on 07-02-2017 5:34 PM
When specifying the property media.globalSettings.s3MediaStorageStrategy.url.signed.validFor=3600 this results in the following error/stacktrace when accessing media objects:
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | java.lang.IllegalStateException: config value for key: url.signed.validFor is not assignable from Integer class
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.media.storage.impl.DefaultMediaFolderConfig.getParameter(DefaultMediaFolderConfig.java:109)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.media.storage.impl.DefaultMediaFolderConfig.getParameter(DefaultMediaFolderConfig.java:119)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.amazon.media.url.S3MediaURLStrategy.getTimeToLiveForUrl(S3MediaURLStrategy.java:122)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.amazon.media.url.S3MediaURLStrategy.getUrlForMedia(S3MediaURLStrategy.java:98)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.jalo.media.MediaManager.getURLForMedia(MediaManager.java:540)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.servicelayer.media.impl.DefaultMediaService.getUrlForMedia(DefaultMediaService.java:647)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.servicelayer.media.DynamicAttributesMediaUrl.get(DynamicAttributesMediaUrl.java:26)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.servicelayer.media.DynamicAttributesMediaUrl.get(DynamicAttributesMediaUrl.java:1)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.servicelayer.internal.model.attribute.impl.DefaultDynamicAttributesProvider.get(DefaultDynamicAttributesProvider.java:46)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.servicelayer.model.ItemModelContextImpl.getDynamicValue(ItemModelContextImpl.java:345)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at de.hybris.platform.core.model.media.MediaModel.getURL(MediaModel.java:361)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | main | 2017/06/30 12:46:06.371 | at java.lang.reflect.Method.invoke(Method.java:498)
It fails due to this code:
public <T> T getParameter(String key, Class<T> requiredType) {
Object value = this.settings.get(key);
if(value != null && !requiredType.isAssignableFrom(value.getClass())) {
throw new IllegalStateException("config value for key: " + key + " is not assignable from " + requiredType.getSimpleName() + " class");
} else {
return value != null?value:null;
}
}
Hybris treats the configured value in the local.properties file as a String and therefore throws an IllegalStateException. Anyone came accross this issue and found a workaround besides overriding this code?
Thanks in advance,
Yannick
This is because of an error in the amazoncloud-spring.xml file. It has a ConfigValueMappingRegistrar entry, but the property name is wrong:
<bean id="urlValidForKey" class="de.hybris.platform.media.storage.impl.ConfigValueMappingRegistrar" p:key="url.validFor" p:value-ref="integerConfigValueConverter"/>
As you can see the property name here is url.validFor; however the documentation says it should be url.signed.validFor (and this is the property used in S3MediaStorageStrategy).
You should be able to fix the bug by adding another spring entry in your custom extension's spring file for the correct property name:
<bean id="urlValidForKey" class="de.hybris.platform.media.storage.impl.ConfigValueMappingRegistrar" p:key="url.signed.validFor" p:value-ref="integerConfigValueConverter"/>
If you don't want to add the Spring "p" namespace, the bean definition looks like this:
<bean id="urlSignedValidForKey" class="de.hybris.platform.media.storage.impl.ConfigValueMappingRegistrar">
<property name="key" value="url.signed.validFor" />
<property name="value" ref="integerConfigValueConverter" />
</bean>
Apparently this has been fixed in 6.7: https://jira.hybris.com/browse/ECP-2418
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.