Can't get cuba.fileStorageDir to work

Hi:

I am trying to get my file storage out of the work directory, as it is being deleted with every redeploy. I have tried these settings in app.properties in my core module:

cuba.fileStorageDir = …/…/filestorage

AND

cuba.fileStorageDir = ${catalina.base}/filestorage

Note my catalina.base is /opt/tomcat8/rade-jvn (I think!)

The directory does exist and is owned by tomcat:

image

In both cases, I still get the error:

2020-04-28 15:15:40.230 ERROR [https-jsse-nio-8043-exec-52/rade-jvn-core/admin] com.haulmont.cuba.core.app.filestorage.FileStorage - File /opt/tomcat8/rade-jvn/rade-jvn-core/work/filestorage/2020/04/28/f5c14a90-9a62-7c73-7151-c805e04d72b5.gif not found

As you can see, it is still trying to write to rade-jvn-core/work/filestorage.

Can somebody help me fix this?

Maybe another wrinkle to add. I have set this value in an App Component which is then loaded into my main app. I found that value has to be set in the main App. I guess the default is overriding my setting in the App Component. I guess it is by design so you can override app component configuration settings.

It would be great, though, if a setting that I override in an App Component is preserved if it is NOT set specifically in my main app.

Hi,

When you set application property in an add-on, you have to explicitly export it via app component descriptor - app-component.xml.

E.g. see in restapi:

        <property name="cuba.securityScopes" value="+REST"/>

        <property name="cuba.rest.client.tokenExpirationTimeSec" value="43200"/>

see also A.app-component.xml - CUBA Platform. Developer’s Manual

And just a hint.
You can quickly check what is the value of the file storage directory in the running server by going to the Administration -> Jmx Console -> bean “…FileStorage”:
image

Thank you! I completely missed that in the docs. I will try it out.

I did know about the JMX Bean, which is how I knew that my settings weren’t taking. Now, at least, I know why.