OpenBoxes WAR file cannot start in tomcat 7

Hi community , @jmiranda i got the openboxes WAR file from the official github page and tried to deploy on my local ubuntu instance but without much success for 4 days now.
These are the details. can some one help out.

My system is ubuntu 20
OpenJDK-7 , tomcat-7 . I have tried to hack around all possible ways with no solution.

my properties file is at /opt/tomcat/.grails

and my properties file contents are

dataSource.username=openboxes
dataSource.password=************************
#dataSource.url=jdbc:mysql://localhost:3306/openboxes?useSSL=false
dataSource.url=jdbc:mysql://localhost:3306/openboxes

Used primarily with g:link when absoluteUrl is true (e.g. links in emails)

grails.serverURL=http://localhost:8080/openboxes

OpenBoxes mail settings - disabled by default (unless you set up an SMTP server)

#grails.mail.enabled=true

These are my Catalina.out logs are May 28, 2021 1:14:25 PM org.apache.catalina.core.AprLifecycleListener initINFO - Pastebin.com

Send your catalina.out log to support at openboxes.com and I’lll see if I notice anything.

If everything is configured properly this is usually caused by an interruption to the Liquibase database migrations (used to create the OpneBoxes data model) which can take 20-30 minutes to run.

Due to the long delay people assume that something went wrong so they stop tomcat while Liquibase is still running through all of the database migrations. This leaves the application in an invalid state (i.e. a database lock is left behind) and that prevents the application from starting. It’s easy fix but send me the log so i can confirm that this is the problem.

Ok, so I just got your logs and noticed that the issue was much simpler than I expected. The application is not able to create database connections for the connection pool. Usually that’s because the credentials aren’t correct.

2021-05-31 10:36:27,969 [C3P0PooledConnectionPoolManager[identityToken->z8kfsxah1hn3o6auke74r|4fb11cb4]-HelperThread-#0] WARN  resourcepool.BasicResourcePool  - 
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@47eab06e -- Acquisition
 Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed
 to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition
 attempt exception: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create 
connection to database server. Attempted reconnect 3 times. Giving up.

If we go back up to the top of the logs you’ll see that the configuration files aren’t being loaded. And the path is actually not correct.

INFO: Deploying web application archive /opt/tomcat/webapps/openboxes.war
Using configuration locations [classpath:openboxes-config.properties, classpath:openboxes-config.groovy, file://.grails/openboxes-config.properties, file://.grails/openboxes-config.groovy] [production]
Unable to load specified config location classpath:openboxes-config.properties : class path resource [openboxes-config.properties] cannot be opened because it does not exist
Unable to load specified config location classpath:openboxes-config.groovy : class path resource [openboxes-config.groovy] cannot be opened because it does not exist
Unable to load specified config location file://.grails/openboxes-config.properties : .grails
Unable to load specified config location file://.grails/openboxes-config.groovy : .grails

This can happen if you don’t create a tomcat user or the tomcat user doesn’t have a home directory specified.

See the instructions here to make sure
https://docs.openboxes.com/en/latest/installation/ubuntu1804/tomcat/

  • You created the tomcat user properly
  • You created the tomcat.service properly
  • Check to see if the tomcat user has a home directory in your /etc/passwd file)

Can you send me the tomcat.service file you created as well?

I created ,a tomcat user , gave it permissions and ownership , created the tomcat.service as well, may be the last option.

However my tomcat server is found at /opt/tomcat/ .

let me check that again.

The tomcat entry in /etc/passwd should look something like this

$ cat /etc/passwd | grep tomcat
tomcat:x:1001:1001::/opt/tomcat:/bin/false

instead of

tomcat:x:1001:1001::/opt/tomcat:/bin/false

Kepp getting the same error

Ok so that rules out that problem. Can you attach your tomcat.service and explain in detail how you start up Tomcat i.e. include the command(s) you execute?

FYI, I’m not opposed to jumping on your server to debug the issue myself. I’ll share my public key if/when you’re interested in that approach.

Oh actually I might have misread that. What is the error you’re getting?

I use these for start , status , stop , restart respectively

sudo service tomcat start
sudo service tomcat status
sudo service tomcat stop
sudo service tomcat restart

Alright can you set me up with a user on your system? If you want to go that path, just send me the IP and user credentials via support at openboxes.com and I’ll investigate in the morning.

I use a local machine, not yet deployed on cloud.

How can we do this.?

Let’s schedule a troubleshooting session and we can work through it together.

It’s finally writing the database , so will give you updates when it’'s complete.

@jmiranda Am up and running on my local instance , may be one more question .

I did a folk of my clone and would like to do some customization on my UI but am not sure how do do the following.

1.build with Grails after changes
2.Watch live project changes during development
3.How many users can openboxes support on cloud ?
e.t.c

i.e common tasks done by maven .

How did you finally get it to work?

Apologies. This got a bit long and probably deserves its own topic. But here goes.

1.build with Grails after changes
2.Watch live project changes during development

So I would recommend following the instructions in the README to get the application running in development mode on your local machine.

Let me know if you run into any issues. You should be able to use the same openboxes-config.properties file. Just copy (or symlink) the file using to the .grails directory under your home directory.

$ mkdir ~/.grails
$ ln -s /opt/tomcat/.grails/openboxes-config.properties ~/.grails/openboxes-config.properties

It’s great that you learned how to deploy the application to Tomcat, but now you’ll need to disable the Tomcat service since running Grails locally will start up an embedded Tomcat instance on the same port(s) that the tomcat.service listens on (i.e. 8080). You can configure it to run on a different port if you want, but I prefer disabling Tomcat altogether.

$ sudo systemctl disable tomcat.service
tomcat.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable tomcat

FWIW, I also use ngrok (https://ngrok.com) for SSH tunneling so that I can share my local OB instance

3.How many users can openboxes support on cloud ?

There are two ways to interpret this question, so I’ll try to respond to both.

  1. If by “users” you mean actual users logging into the system

There’s virtually no limit to the number of users that OpenBoxes can support as long as you can vertically scale your VM. However, since there is a limit to scaling vertically, the default deployment strategy (i.e. all services deployed on one VM) is bound by memory and CPU of the VM. Meaning eventually you could conceivably run into issues, but unless you’re handling a high level of volume, you will probably not need that.

With that said, we’d definitely recommend setting up your deployment the right way if you have the money and technical expertise. The “right way” means that you should set up your OB instance to scale horizontally from the beginning by adding multiple VM or PaaS instances of Tomcat to support whatever user load you expected, place those Tomcat instances behind a load balancer to balance traffic between those servers, and deploy the database to a PaaS MySQL service on the same virtual private network as the application servers.

We don’t have any documentation on this yet, but I’d be happy to further the conversation here if that’s something you’re interested in. I’ve been meaning to set up a reference implementation that demonstrates how OB can be run in a high availability cluster, deploying read-replicas of the database in another region in order to support redundancy (failover) as well as advanced business intelligence / reporting use cases.

  1. If by “users” you mean tenants (organizations with users)

If you’re looking to implement multi-tenancy (i.e. multiple tentants supporting their own set of users), that is not officially supported yet. And honestly, it might be very difficult without a large refactoring. But you can get close to multi-tenancy using location-specific roles (user access can be restricted to certain locations). However, users would still share some global data like products and suppliers.

Wow , thanks alot @jmiranda for the wealthof info .

I think my use case best suits multitenancy model . Iam going to deploy a single OB instance on the cloud , and have countless basic users in different areas Uganda do basic Inventory work without caring about system maintenance and administration .

So i’ll probably give them roles and privileges . i have not yet learned how well that is done .
Then do a vertical VM scaling and add load balancers.

Also i think a bit of that is lacking in the documentation , so probably we may update the documentation.

To be honest the setup was a little daunting .What i did was remove everything and do afresh setup.

will keep you posted.

Regards Tendo

To be honest the setup was a little daunting .What i did was remove everything and do afresh setup.

So you’re still not sure what was causing the problem? That’s frustrating.

No , actually the root@localhost was the cause of the headache.