Unable to load entity - because it has been deleted or access denied

Good day to all.
I have the following problem, I try to read an image from file storage. Every time I try it always returns the same error:

com.haulmont.cuba.core.global.FileStorageException: File not found: XXXX.jpg
	at com.haulmont.cuba.core.sys.remoting.LocalFileExchangeServiceBean.downloadFile(LocalFileExchangeServiceBean.java:50) ~[cuba-core-7.1.1.jar:7.1.1]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]

Report that the cause says it is

Caused by: com.haulmont.cuba.core.global.EntityAccessException: Unable to load entity trz_ExtFileDescriptor-f2d60024-01e8-ce9f-3262-f569be49be06 because it has been deleted or access denied
	at com.haulmont.cuba.core.app.DataManagerBean.reload(DataManagerBean.java:118) ~[cuba-core-7.1.1.jar:7.1.1]
	at com.haulmont.cuba.core.app.DataManagerBean.reload(DataManagerBean.java:103) ~[cuba-core-7.1.1.jar:7.1.1]
	at com.haulmont.cuba.core.app.DataManagerBean.reload(DataManagerBean.java:98) ~[cuba-core-7.1.1.jar:7.1.1]
	at com.haulmont.cuba.core.app.DataManagerBean.reload(DataManagerBean.java:93) ~[cuba-core-7.1.1.jar:7.1.1]
	at com.haulmont.cuba.core.sys.remoting.LocalFileExchangeServiceBean.downloadFile(LocalFileExchangeServiceBean.java:48) ~[cuba-core-7.1.1.jar:7.1.1]

I have verified the permissions and the user has access to the table without restrictions, but still reports the error.
The curious thing is that I do the same but from an anonymous session to a process that is required and works perfectly. So what am I doing wrong or can’t I understand?

I verify the logined user, I look for their assigned inquilo and process with retrieving the record containing the image.

logoTenant.setSource(FileDescriptorResource.class).setFileDescriptor(extTenant.getLogo().getFile());
logoTenant.setSource(StreamResource.class).setStreamSupplier(() ->
                    new FileDataProvider(extTenant.getLogo().getFile()).provide()).setBufferSize(1024);

None of the above lines work

image

Any idea about it?

Nelson F.

Any suggestions? I don’t know where else to look

Hello @nelsonflorez,

Sorry for the long wait. Please send a project with this problem or send a test project which also reproduces the problem. Thank you.

Regards,
Nikita