If you try to upload a logo to a collection you get this error: java.nio.file.AccessDeniedException: /opt/payara/../docroot
Originally reported here: https://github.com/IQSS/dataverse-docker/issues/85#issuecomment-1590391145
[#|2023-06-15T19:31:50.220+0000|WARNING|Payara 5.2022.5|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=99;_ThreadName=http-thread-pool::http-listener-1(4);_TimeMillis=1686857510220;_LevelValue=900;|
/themeAndWidgetsFragment.xhtml @58,239 listener="#{themeWidgetFragment.handleImageFileUpload}": java.lang.RuntimeException: Error creating temp directory
javax.el.ELException: /themeAndWidgetsFragment.xhtml @58,239 listener="#{themeWidgetFragment.handleImageFileUpload}": java.lang.RuntimeException: Error creating temp directory
...
Caused by: java.lang.RuntimeException: Error creating temp directory
at edu.harvard.iq.dataverse.ThemeWidgetFragment.createTempDir(ThemeWidgetFragment.java:96)
at edu.harvard.iq.dataverse.ThemeWidgetFragment.handleImageFileUpload(ThemeWidgetFragment.java:249)
...
Caused by: java.nio.file.AccessDeniedException: /opt/payara/../docroot
Here's line 96 above: https://github.com/IQSS/dataverse/blob/9feb865e9fc67ea6ba027cc36e7dbafef1301085/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java#L96
Related is the note about collection logos at https://guides.dataverse.org/en/5.13/installation/advanced.html#multiple-app-servers
I created https://github.com/IQSS/dataverse/issues/9662 for this.
Some poor hardcoded design choices in there...
Starting hacking on a PR to resolve the tech debt
Perfect! Thanks for taking a look!
Course!
@Philip Durbin @Don Sizemore I'm tempted to add the idea expressed in https://github.com/IQSS/dataverse/issues/9572 to the scope of this, as we need to check for these configured folders... Would it make sense to combine this?
@Oliver Bertuch I think checking for the existence (and ownership/mode) of necessary directories on service launch is a good thing to add.
At the very least log an error about missing directories, I'd say
@Don Sizemore @Philip Durbin here's the first version of this config checking: https://github.com/poikilotherm/dataverse/commit/a4ec3a66e76aa1559aea0c05cedc2da2b38d7b03
It does fail deployment on startup if some check is not successful
Looks good! I bet the error messages are informative.
@DependsOn("StartupFlywayMigrator") means it gets run after flyway, I assume.
I tried to make it as decriptive as possible, even add hints about the JVM setting names
Yeah, it happens after Flyway
Which also means you will see all those Flyway messages... So you need to scroll up up up up to see the log messages...
There's not really a way around that - I'd prefer to have the checking run after flyway if we use it later for DB settings that might need a migration some day.
I guess I'm used to scrolling up. No big deal. :happy:
Green light from me. Wanna run it by #dv-tech?
Gimme a sec. Still need to hack the docroot bit
At least now we can verify things are present and we don't fall over strange configs.
Who knows, maybe we can add additional pre-flight checks in the future :airplane:
Yeah I'd love this!
There's got to be a flotation/float dad joke here.
I'm getting there... Lots of places in the code where things are hardcoded where the docroot shall be. Good to change all of them...
Oh isn't it just great... :angry:
Now I found just another bug in Payara
But this time it's failing big time
They are using a regex approach for variable substitution in web.xml and other files...
(https://github.com/payara/Payara/blob/payara-server-5.2022.5/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/TranslatedConfigView.java for the curious ones)
Which means ${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot} is taken apart with their regexes by cutting of /docroot after the second last bracket.
Gnaaaah
I can't believe nobody actually tested this
Yeah well... Their tests don't cover recursive usage. :rolling_eyes: https://github.com/payara/Payara/blob/payara-server-5.2022.5/nucleus/admin/config-api/src/test/java/org/glassfish/config/support/TranslatedValueTest.java
But maybe they just forgot to add "no deep nesting allowed" in their docs... https://docs.payara.fish/community/docs/Technical%20Documentation/Payara%20Server%20Documentation/Server%20Configuration%20And%20Management/Configuration%20Options/Variable%20Substitution/Types%20of%20Variables.html
So this would be a new feature then...
Good times
Crazy idea: store collection logos in the database
Philip Durbin said:
Crazy idea: store collection logos in the database
I support this!
I don't - storing binary blobs in databases has never been a good idea.
Ok ok. We'll figure it out. :stuck_out_tongue_wink:
Oliver Bertuch said:
Which means
${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot}is taken apart with their regexes by cutting of/docrootafter the second last bracket.
I think I might have run into this one with dataverse-docker setup; we have a couple of logo's because logo's make management happy (c); I always, always end up copying them in the right spot with right permissions after upload and then it "magically" works.
Yeah it's just great. I still didn't have the time to come around and file a bug report.
Could add an env var to the image instead, but it feels kind of dirty to me
But probably the easiest workaround for now...
Make it work, file a bug report, create a todo issue to get back to this in our image when resolved upstream
So I created this: https://github.com/IQSS/dataverse/pull/9819 But it will not be merged for 6.0. Will fight to get it merged for 6.1 as it is a blocker on containers. @Thomas van Erven
Much obliged, I'll owe you a beer once it's solved (though it's honestly a minor amount of work to do so - the main amount of work is in debugging why logo's aren't showing in the first place)
:beer: :dissolve: - I'll be in for a coke :smiley:
Yeah, I made the solution harder for myself by adding all the checks on startup... :see_no_evil:
Really we're just waiting for 6.0 to ship before we turn around attention to PRs like this. Thanks for your patience! I think we're close!
Merged! :tada: Configurable docroot via MicroProfile Config #9819
Works great!
Screenshot-2023-10-13-at-3.33.34-PM.png
Thanks,
@Oliver Bertuch
!
I _think_ this is solved now. Marking as such :smile_cat:
Oliver Bertuch has marked this topic as resolved.
Last updated: Oct 30 2025 at 05:14 UTC