ADempiere and Tomcat #4292
marcalwestf
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ADEMPIERE AND TOMCAT (3.9.3 , 3.9.4)
Since ADempiere 3.9.3, Tomcat must be installed separately and be referred to in the ADempiere installation. Same applies to Jetty and Wildfly, too.
I IS TOMCAT RUNNING?
THE TOMCAT VERSION WE MUST USE IS 9.0.50 (as far as I know right now)
Test installed Tomcat Version:
Supposing, Tomcat has been installed, run the following:
Result:
Does Tomcat run as Service?
What happens if it does not run as a service?
Unit tomcat.service could not be found.
II TOMCAT INSTALLATION
URL: https://phoenixnap.com/kb/install-tomcat-ubuntu
Create Tomcat group:
sudo groupadd tomcat
Add user westfalia to group tomcat:
sudo usermod -a -G tomcat westfalia
Tests:
group westfalia
id westfalia
Tomcat user:
sudo useradd -s /bin/false -g tomcat -d /data2/programme/apache-tomcat-9.0.50 tomcat
Change Password for User "tomcat" (to "tomcat"):
sudo passwd tomcat
groups tomcat
sudo chown -RH tomcat: /data2/programme/apache-tomcat-9.0.50
sudo sh -c 'chmod +x /data2/programme/apache-tomcat-9.0.50/bin/*.sh'
III CREATE SYSTEM UNIT FILE
Create and open a new file in the /etc/system/system under the name tomcat.service:
sudo nano /etc/systemd/system/tomcat.service
Change to following contents
In the instructions there was User/Group=tomcat; if you change the group as I did to "westfalia", you must change it accordingly; otherwise you'll get an error.
IV START TOMCAT AS A SERVICE
For the changes to take place, reload the system daemon with the command:
sudo systemctl daemon-reload
Start the Tomcat service:
sudo systemctl start tomcat
Verify the Apache Tomcat service is running
sudo systemctl status tomcat
Result:
For the following command, you may have to install "ufw"
sudo ufw enable
sudo ufw allow 8080
Check Tomcat run on browser
http://localhost:8080/
http://192.168.0.201:8080/
Stop the Tomcat service:
sudo systemctl stop tomcat
V ADEMPIERE SETUP WITH TOMCAT
If you have followed the previous instructions. you can proceed to ADempiere-Setup.
On ADempiere Setup Window make sure to have the correct entries in order to avoid any malfunction:
1 On Setup Window
2 Variables, which are consequence of Setup
This will become CATALINA_HOME when executing ./RUN_Server2.sh.
This will become CATALINA_BASE when executing ./RUN_Server2.sh.
If the installation is done graphically:
When Setup OK, the installation ends with
When Setup OK, Server start:
./RUN_Server2.sh
VI DEBUGGING WITH ECLIPSE AND TOMCAT IN WINDOWS
Important!!!!
This are my findings since ADempiere 3.9.4
I had to do the changes described in order to get Tomcat running on Eclipse in Windows.
You must do these changes, test and revert them after debugging.
If somebody has another solution, please share it so we all improve.
1.- Correction in DB_PostgreSQL.getDataSource()
Line 614:
DataSource dataSource = InitialContext.doLookup("java:comp/env/java/AdempiereDS");
On Windows, it produces an Exception, which is caught and program continues on line.
On Ubuntu 22.04 there is no Exception, and the variable is returned.
To avoid the exception you must comment line 616:
// return dataSource;
See image:
2.- IP in Server Configuration
The IP in the Server Configuration istn't "localhost", but the real IP.
As in following image:
Then it works!!!!
VII TOMCAT AND PROJECT ADEMPIERE-ALL-SERVICES
When working with the projects "adempiere-all-services", "adempiere-ui-gateway" or with containers, you may find of interest the following.
First, Tomcat must be started.
The database can be
Start Tomcat as explained before.
Problem can arise when starting the project "adempiere-all-services" (docker compose up -d) an error pops up:
Error response from daemon: driver failed programming external connectivity on endpoint adempiere-saprod.site (eaed58c899779fac5765bcc99defc78543588f9a7a2cb3b6d725a320318d84ea): Error starting userland proxy: listen tcp4 0.0.0.0:8080: bind: address already in use.
First, find out the process which reserves the port:
sudo lsof -i :8080
With "sudo ps -efa | grep " I find out that is the local Tomcat:
westfal+ 1304 1 0 Jan05 ? 00:01:22 /usr/lib/jvm/jdk-11.0.11+9/bin/java -Djava.util.logging.config.file=/data2/programme/apache-tomcat-9.0.50/conf/logging.
Either kill the process or (better) stop Tomcat:
sudo systemctl stop tomcat
Beta Was this translation helpful? Give feedback.
All reactions