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

java.io.IOException: File name too long error during Hybris server restart

former_member842041
Discoverer
0 Likes
2,129

Hi All,

I got below error when i have restarted the hybris server. When i have cleared the media cache issue got fixed.

Is there is any limit on file name length ?

Hybris version 5.7.0.6

Media cache file name:

 /root/h97/hd6/c3lzLW1hc3Rlci9yb290L2hjOC9oZjAvOTIxNzY2Nzg5MTIzMC9BcHBsZSBXYXRjaCBTZXJpZXMgMyAoR1BTICsgNEcpIDM4bW0gR29sZCBBbHVtaW5pdW0gQ2FzZSB3aXRoIFBpbmsgU2FuZCBTcG9ydCBCYW5kIC0gR2FuIC0gcHJpbWFyeV9Gb3JtYXQtMTEyMA==__H__09b96f34-76a9-48eb-aad7-ae0bf6ef6b64.bin.EVICTED  
    /root/h97/hd6/c3lzLW1hc3Rlci9yb290L2hjOC9oZjAvOTIxNzY2Nzg5MTIzMC9BcHBsZSBXYXRjaCBTZXJpZXMgMyAoR1BTICsgNEcpIDM4bW0gR29sZCBBbHVtaW5pdW0gQ2FzZSB3aXRoIFBpbmsgU2FuZCBTcG9ydCBCYW5kIC0gR2FuIC0gcHJpbWFyeV9Gb3JtYXQtMTEyMA==__H__09b96f34-76a9-48eb-aad7-ae0bf6ef6b64.bin


logs:

 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1222)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         ... 37 more
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localMediaFileCacheService': Invocation of init method failed; nested exception is java.lang.IllegalStateException: File name too long
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         ... 47 more
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 | Caused by: java.lang.IllegalStateException: File name too long
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService$MediaCacheUnit.writeEvictedMarkerFile(DefaultLocalMediaFileCacheService.java:579)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService$MediaCacheUnit.tryRemoveResourceOrWriteEvictedMarker(DefaultLocalMediaFileCacheService.java:523)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService$MediaCacheLifecycleCallback.markAsEvictedAndTryRemove(DefaultLocalMediaFileCacheService.java:628)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService$MediaCacheLifecycleCallback.onAfterEviction(DefaultLocalMediaFileCacheService.java:615)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.DefaultCacheController.executeOnEvictionCallbacks(DefaultCacheController.java:434)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.DefaultCacheController$1.onAfterEviction(DefaultCacheController.java:141)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.LRUCacheRegion.notifyEvictionListener(LRUCacheRegion.java:87)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.LRUCacheRegion.access$0(LRUCacheRegion.java:83)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.LRUCacheRegion$1.onEviction(LRUCacheRegion.java:59)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.LRUCacheRegion$1.onEviction(LRUCacheRegion.java:1)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.notifyListener(ConcurrentLinkedHashMap.java:541)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.afterWrite(ConcurrentLinkedHashMap.java:405)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.put(ConcurrentLinkedHashMap.java:727)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.putIfAbsent(ConcurrentLinkedHashMap.java:703)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.LRUCacheRegion.putIfAbsent(LRUCacheRegion.java:74)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.region.impl.AbstractMapBasedCacheRegion.getWithLoader(AbstractMapBasedCacheRegion.java:80)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.MediaCacheRegion.getWithLoader(MediaCacheRegion.java:93)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at uk.co.ee.shop.core.media.EEMediaCacheRegion.getWithLoader(EEMediaCacheRegion.java:49)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.regioncache.DefaultCacheController.getWithLoader(DefaultCacheController.java:239)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.MediaCacheRecreator$MediaCacheFileVisitor.visitFile(MediaCacheRecreator.java:179)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.MediaCacheRecreator$MediaCacheFileVisitor.visitFile(MediaCacheRecreator.java:1)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at java.nio.file.Files.walkFileTree(Files.java:2670)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at java.nio.file.Files.walkFileTree(Files.java:2742)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.MediaCacheRecreator.recreateCacheFromDiskFolder(MediaCacheRecreator.java:102)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.MediaCacheRecreator.recreateCache(MediaCacheRecreator.java:74)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService.init(DefaultLocalMediaFileCacheService.java:94)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at java.lang.reflect.Method.invoke(Method.java:498)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         ... 56 more
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 | Caused by: java.io.IOException: File name too long
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at java.io.UnixFileSystem.createFileExclusively(Native Method)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at java.io.File.createNewFile(File.java:1012)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         at de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService$MediaCacheUnit.writeEvictedMarkerFile(DefaultLocalMediaFileCacheService.java:575)
     INFO   | jvm 1    | main    | 2018/06/13 04:18:52.437 |         ... 88 more
     
     
 

View Entire Topic
0 Likes

Hello ,

I think that path to media cache files is just too long.

There is a limit of file path length. For each filesystem it's different. https://en.wikipedia.org/wiki/Filename (at the end of this article there is a table that shows maximum length).

Can you use shorter filenames?

To avoid problems with long filenames, the good practice is to put Hybris into a directory near the top of your file system.

Best Regards

former_member842041
Discoverer
0 Likes

Thanks

Yes we have placed the Hybris folder is near to top.. Is there any way to shorten the file names?

geffchang
Active Contributor
0 Likes

Is the media filename custom (e.g. is there a business logic that generates a long filename)? If it is, try to make is shorter. We encountered this long filename issue, and the only option was to be mindful of the length of the filename.

0 Likes

Exactly like said,

Can you do that ?

former_member842041
Discoverer
0 Likes

Thanks but Its not custom.