Import templates download results in error

Can not download manyany import templates.

i get error ERR_INVALID_RESPONSE while accessing links like

/openboxes/batch/downloadCsvTemplate?template=products.csv
/openboxes/batch/downloadTemplate?template=locations.xls
/openboxes/batch/downloadTemplate?template=inventoryLevels.xls
etc

but i can download other templates like
/openboxes/product/exportSynonymTemplate?productCode=00003
and data like
/openboxes/batch/downloadExcel?type=Location

what could be the reason for that?

Make sure you set grails.serverURL in your openboxes config file. I believe the URL that is being used is probably http://localhost:8080 so unless you’re running it locally the URL won’t resolve properly.

Do you mean openboxes.yml file located in /opt/openboxes/.grails ?
There is a line
grails.serverURL: http://xx.xx.xx.xx:8080/openboxes
pointing to the ip of the server openboxes is running on

Anything else i could check?

Yes, that’s the config file I was referring to. And this probably has nothing to do with the grails URL but rather with the files on the filesystem. Make sure the tomcat user has at least read on all files under the explored WAR directory (i.e. webapps/openboxes).

If that isn’t the problem, then I’ll need a bit more information to troubleshoot.

Can you send an email to support@openboxes.com with the following details:

  • screenshot of the error
  • stracktrace from catalina.out (if one exists)
  • additional error information in the browser console (Network tab, maybe?)

Nevermind. I just confirmed that the file permission was likely the problem.

Steps to Reproduce

  1. Change ownership of the locations.xls template on the file system

    root@ubuntu-s-2vcpu-4gb-nyc1-01:/var/lib/tomcat9/webapps/openboxes/WEB-INF/classes/templates# chown root:root locations.xls 
    
  2. Confirm that root owns the file

    root@ubuntu-s-2vcpu-4gb-nyc1-01:/var/lib/tomcat9/webapps/openboxes/WEB-INF/classes/templates# ls -al locations.xls
    -rw-r----- 1 root root 11264 Aug  9 00:03 locations.xls
    
  3. Download the locations.xls template

  4. Receive ERR_INVALID_RESPONSE error message.

Solution
To fix this error, change ownership of all files under the Tomcat webapps directory.

chown tomcat:tomcat -R webapps/openboxes

I appreciate your suport, but probably I should check the documentation first to find out where actual files (except WAR and configuration file) are located.
i dont see tomcat as a service, there is not tomcat user/group, there is no directory /var/lib/tomcat9/

I have installed it as described here Overview - OpenBoxes
According to the document it uses “embedded Tomcat” whatever that means :slight_smile:

Apologies. I should have asked which instructions you used to do the installation. I thought you had followed the “beta” version of our documentation, which depends on the Ubuntu 22.04 / Tomcat9 package.

The equivalent step with these instructions is here

sudo chown -R openboxes:openboxes /opt/openboxes

If that doesn’t work, would you mind posting the results of these commands

  • Which user is running the openboxes service?
    ps -ef | grep openboxes
    
  • What are the contents and permissions under the openboxes directory?
    ls -al /opt/openboxes
    
openbox+ 17589     1  1 11:59 ?        00:05:10 /usr/bin/java -Dgrails.env=prod -jar /opt/openboxes/openboxes.war
root     20600 20589  0 18:45 pts/0    00:00:00 grep --color=auto openboxes
total 176932
drwxr-xr-x 4 openboxes openboxes      4096 Oct 15 11:56 .
drwxr-xr-x 3 root      root           4096 Oct 15 11:17 ..
drwxr-xr-x 2 openboxes openboxes      4096 Nov 20 13:11 .grails
-rw-r--r-- 1 openboxes openboxes 181158655 Oct 15 03:04 openboxes.war
drwxr-xr-x 2 openboxes openboxes      4096 Oct 15 11:56 uploads

so it looks ok to me. i have checked the permissions on the directory. I have checked and there have been steps in the installation manual re that which i have followed:

sudo groupadd openboxes
sudo useradd -s /bin/false -g openboxes -d /opt/openboxes openboxes 
sudo chown -R openboxes:openboxes /opt/openboxes

The folder is almost empty by the way, there is nothing in those folders except war and yml files. Is it normal?

Yeah that’s what I was expecting to see once you told me that you were running with the Ubuntu 18.04 (Grails v3) approach. Running the application as a java process with an embedded Tomcat instance means there’s no conventional Tomcat home directory (where we find Tomcat config, webapps, logs). With the more convention approach (installing dependencies from the Ubuntu APT repo) the Tomcat home directory has a webapps directory used for app deployment. The contents of the openboxes.war file get unarchived into a new “openboxes” directory. And you can create problems with that directory by accidentally changing file permissions OR downloading the openboxes.war as root (which creates the file with root as owner).

Anyway, I’m not familiar enough with the embedded Tomcat approach to know whether there’s a temporary location where the contents of openboxes.war are dumped.

On a hunch, I suspected they might be dumped to a /tmp.tomcat directory, but I don’t see anything of interest under this directory.

$ ls -al /tmp/tomcat*
/tmp/tomcat.2111053285461234055.8080:
total 28
drwxrwxr-x   4 jmiranda jmiranda  4096 Nov 22 22:50 .
drwxrwxrwt 102 root     root     16384 Nov 22 22:58 ..
drwxrwxr-x   2 jmiranda jmiranda  4096 Nov 22 22:50 logs
drwxrwxr-x   3 jmiranda jmiranda  4096 Nov 22 22:50 work

And even if there were, it would likely get recreated every time you restarted the openboxes service.

So, as I said in the other thread, if you decide to adopt OpenBoxes, I recommend using the more conventional install process until we can iron out the kinks with the embedded WAR approach.

You mean this installation path Overview - OpenBoxes ?
I was puzzled by the big version number gap between what is on github 0.8.23Hf1 and 0.9.2 available for Ubuntu 18.04 (Grails v3) path.

So which war-file (and app version) as of now should be used for installation with “traditional” Tomcat approach to get more predictable app “runtime environment” and changes after Dec 2023 ?

I confirm that using installation process with standalone Tomcat9 solves this issue, i am able to download all the import templates.