OpenBoxes WAR file cannot start in tomcat 7

Can you elaborate on that? Was there an installation instruction that was wrong or not specific enough? I want to make sure we fix any documentation bugs that could lead others down the same path as you.

I think the documentation is okay , though i used a Apache Tomcat/7.0.47 .

And i like the flow. Though the user needs to be told to follow the guidelines step by step

A few clarifications ,

As a first time user i need to know when and where to put the openboxes-config.properties file . It’s not obvious for me to know that i have to create a hidden .grails folder.

.

That’s great feedback. And I have heard the same thing from other users. In fact, I actually thought I had added that instruction to the documentation so I’ll need to review why that change is missing (i.e. it might be in a PR or another branch that hasn’t been merged yet).

1 .I also need to know all the configuration files i have to deal with i.e application and database server configs and which time.

2 . I don’t know wether this true for future versions , (I know there is alot for OB)but would suggest an automated installation process something similar done by OpenMRS . So most of the dirty work is done by a script

1 .I also need to know all the configuration files i have to deal with i.e application and database server configs and which time.

Could you elaborate on what you mean by this?

2 . I don’t know wether this true for future versions , (I know there is alot for OB)but would suggest an automated installation process something similar done by OpenMRS . So most of the dirty work is done by a script

Who do you think I am, Daniel Kayiwa?
https://wiki.openmrs.org/display/~dkayiwa

Kidding, I’ll never be as good as Daniel.

So I’m not sure if you were referring to dkayiwa’s amazing OpenMRS Standalone …

https://wiki.openmrs.org/display/docs/OpenMRS+Standalone

… but we might not ever create an easy install tool like this because we’d rather spend our energy on deploying to cloud. However, given the disclaimer they added about it now being production-ready-ish I’ll investigate it at some point

In the meantime we can do something similar using Docker / Docker Compose. See the following repository for instructions on how to get OpenBoxes running using Docker.

I know this isn’t as easy as running a Windows Installer, but we don’t have the capacity to handle the development, troubleshooting, and support for something like OpenBoxes standalone. If someone from the community wanted to build / maintain that type of installer, we’d be thrilled.

As for installing a production-ready version of OpenBoxes on a cloud server, we have a few projects in the works.

DigitalOcean Marketplace

You can create a DigitalOcean droplet with OpenBoxes fully installed and configured straight from the DigitalOcean Marketplace.

Apparently you’ll receive $100 in credit from DigitalOcean (~5 months) by launching a droplet using the following link.

Self-Service Deployment

As part of a project that is being funded through Digital Square, we are also building infrastructure as code components that will allow us to launch a Basic (single VM) or High Availability (all services running on their own nodes) version of OpenBoxes to most hosting providers with the simple click of a button. We are starting with Azure, but hope to get everything working with AWS and GCP as well.

You can read the announcement below for more information.

By this i was not actually talking about Standalone but rather the GUI intallation process guide which appears during deployment on tomcat.

No

Ah yes, the installation wizard. I have been thinking about how we might be able to accomplish something like that. Part of the Digital Square funding is for User Onboarding which will be a step-by-step wizard for importing data and configuring specific features once the application has been installed and the database has been created.

But maybe we can take a step backwards to see if there’s an easier way to launch OpenBoxes. If I recall correctly we’d need to create a separate web app to handle the wizard workflow since it needs to be able to prompt the user for database properties (i.e. OpenBoxes can’t be launched until database properties are in place).

So this is a few months later but I hope I get a response. I followed Overview - OpenBoxes without success and I am having to come here leg’s between tails for assistance.

I am running an Ubuntu 18.04 Container with 2 cores, 2GB RAM, 32GB HDD on Proxmox. Sufficient enough resources I believe.

JAVA

openjdk version "1.7.0_332"
OpenJDK Runtime Environment (Zulu 7.52.0.11-CA-linux64) (build 1.7.0_332-b01)
OpenJDK 64-Bit Server VM (Zulu 7.52.0.11-CA-linux64) (build 24.332-b01, mixed mode)

MySQL
mysql Ver 14.14 Distrib 5.7.37, for Linux (x86_64) using EditLine wrapper

Tomcat
Apache Tomcat 7.0.99

With the provided tomcat.service script, I was getting the following error

Process: 16187 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)

So I switched to another tomcat service script that i knew was working

sudo nano /etc/init.d/tomcat

#!/bin/bash
### BEGIN INIT INFO
# Provides:         tomcat
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Auto-starts tomcat
# pidfile: /var/run/tomcat.pid
### END INIT INFO

case $1 in
start)
sh /opt/tomcat/bin/startup.sh
;;
stop)
sh /opt/tomcat/bin/shutdown.sh
;;
restart)
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
;;
esac
exit 0

Then ran

sudo chmod 755 /etc/init.d/tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
sudo systemctl enable tomcat

I could run any of the following successfully

sudo systemctl status tomcat
sudo systemctl stop tomcat
sudo systemctl start tomcat

Tomcat 7 was running.

Installed MySQL Server 5.7 as follows

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb

Selected MySQL 5.7

Then

sudo apt update
sudo apt install mysql-server-5.7 -y

Then

mysql -u root -p -e 'create database openboxes default charset utf8;'
mysql -u root -p -e 'grant all on openboxes.* to openboxes@localhost identified by "<provided proper password here>";'

and was able to login with

mysql -u openboxes -p openboxes

and show tables;

mysql> show tables;
Empty set (0.00 sec)

edited /etc/mysql/mysql.conf.d/mysqld.cnf using nano

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
bind-address            = 0.0.0.0

At this point, I was able to confirm that both Tomcat 7 and MySQL 5.7 where up and running and Java was properly installed.

Created openboxes-config.properties in

/opt/tomcat/.grails/openboxes-config.properties

Content was

# Database connection settings
dataSource.username=openboxes
dataSource.password=myPasswordCorrectlyEnteredHere
dataSource.url=jdbc:mysql://localhost:3306/openboxes?useSSL=false

# 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

I start tomcat and tail catalina.out

I get several lines of

Mon Feb 21 22:23:06 UTC 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

before getting

2022-02-21 22:23:06,938 [C3P0PooledConnectionPoolManager[identityToken->1hgekr6an8fg7e11laqxcz|1295ebd]-HelperThread-#2] WARN  resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5db601cd -- 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.CommunicationsException: Communications link failure

and then a host of other errors.

I am definite MySQL and Tomcat7 are properly installed.

Please help

Thanks a lot for the detailed message.

So the first thing I noticed was that jdbcUrl for the connection pool is set to the default rather than the one in your openboxes-config.properties.

2022-02-21 19:43:58,827 [localhost-startStop-1] INFO  impl.AbstractPoolBackedDataSource  - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 5, acquireRetryAttempts -> 30,
 acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> co
m.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgekr6an89s92mef1mo5|7cf43ddf, debugUnreturnedConnectionStackTraces -> false, description -> null, driverCla
ss -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hg
ekr6an89s92mef1mo5|7cf43ddf, idleConnectionTestPeriod -> 7200, initialPoolSize -> 10, jdbcUrl -> jdbc:mysql://localhost:3306/openboxes?autoReconnect=true&zeroDateTimeBehavior=convertToNull&sessionVariables=stora
ge_engine=InnoDB, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 14400, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 1800, maxPoolSize -> 100, maxStatements -> 180, maxStatementsPerConnection -> 0, min
PoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> SELECT 1, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 
1, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
Mon Feb 21 19:43:59 UTC 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be establ
ished by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting
 useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

That usually tells me that the application is not picking up the OpenBoxes configuration file(s) which we can see in the following snippet.

Using configuration locations [classpath:openboxes-config.properties, classpath:openboxes-config.groovy, file:/root/.grails/openboxes-config.properties, file:/root/.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:/root/.grails/openboxes-config.properties : /root/.grails/openboxes-config.properties (No such file or directory)
Unable to load specified config location file:/root/.grails/openboxes-config.groovy : /root/.grails/openboxes-config.groovy (No such file or directory)

The issue is that Tomcat is being started by the root user rather than the tomcat user. I think this is a byproduct of moving from using the tomcat.service from the instructions to one you created yourself.

This is fine. Just move the configuration that you created under /opt/tomcat/.grails to /root/.grails and everything should start up properly.

If you want to debug the issue you were running into with tomcat.service let me know and we can troubleshoot that together.

Process: 16187 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)

Hello @jmiranda
Thank you too for the very detailed troubleshooting. I appreciate you taking time out to offer what I would call free support.

So following your response I decided to create a new server and I was able to identify why I was unable to get the tomcat.service to work as outlined in the Installation guide. After running

readlink -f /etc/alternatives/java
/usr/lib/jvm/zulu-7-amd64/jre/bin/java

I failed to adhere to this VERY CRITICAL point

Copy the path up to /bin/java. For example,
/usr/lib/jvm/zulu-7-amd64/jre

So for Java_Home I entered
/usr/lib/jvm/zulu-7-amd64/jre/bin/java instead of
/usr/lib/jvm/zulu-7-amd64/jre

After installing Tomcat, starting the service and tailing catalina.out I observed that it was looking for java in

/usr/lib/jvm/zulu-7-amd64/jre/bin/java/bin/java

which was what was trigerring

Process: 16187 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)

Correctly entering the java path got the tomcat.service script (as described in the referenced install guide) running. Yaaaay! Two heads are really better than one “smart-alec” head.

So Java correctly installed, Tomcat runs. MySQL runs. The entire underlying infrastructure runs properly.

I’m still unable to get openboxes.war to properly deploy with an error about being unable to login to MySQL as root@localhost. I have openboxes-config.properties correctly located at /opt/tomcat/.grails/openboxes-config.properties with correct login details. I will upload the latest catalina.out as soon as I’m at my computer and then modify this comment with a link. Hopefully we can identify the offending configuration. Once again, thank you very much for your valuable time.

UPDATE:
So after identifying the error mentioned above, I meticulously followed the Installation guide here Overview - OpenBoxes

Started the server and I am happy to report that it is up and running. Thank you once again @jmiranda for the support provided.

Now let me hop along and try the Grails v3 version (Overview - OpenBoxes) for a side by side comparison

Yay. Sorry for not responding earlier. Kid and wife have Covid so I’ve been away from my computer all day.

As I mentioned in the other thread, the Grails 3 version is still in development (albeit stalled). I’m not sure when that will get restarted as we’re trying to find time and money to dedicate to the project so it doesn’t stall for a third time.