Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Maximo failing to connect to database after docker-compose stop and docker-compose start #14

Open
lhchang opened this issue May 28, 2020 · 5 comments

Comments

@lhchang
Copy link

lhchang commented May 28, 2020

Hello,
I'm running into an interesting issue where after building the containers and verifying everything is working correctly, after running docker-compost stop then docker-compose start again, I can no longer access localhost/maximo due to a 500 error. Looking in the /opt/IBM/WebSphere/AppServer/profiles/ctgAppSrv01/logs/MXServer/SystemOut.log logs, i notice the following failing:

BMXAA6421E - The system could not connect to the JDBC source: jdbc:sqlserver://;

Despite this message, netstat shows that 1433 is open on 0.0.0.0 on the db container and I can even access it using dbeaver on my host. Is there any guidance on how to solve this issue or ideas on why this issue might be occurring?

Thank you

@nishi2go
Copy link
Owner

Hi,
It seems the application server has started before opening the database port 1433. The maxapps container specified to wait opening the DB_PORT variable specified in .env file in startapp.sh. Please recheck the DB_PORT and DB_HOST_NAME parameters and the sentence "Database is up" appeared in the maxapps log.

Thanks.

@lhchang
Copy link
Author

lhchang commented May 29, 2020

Hello,
After a reboot of my host machine, docker-compose start now works and localhost/maximo can be reached. However I am running into the same issue after I've tried to restore my database(sqlserver). Tools like nmap and nc show the port 1433 on maxdb open on maxapps and maximo container, and I see the docker-compose log messages "Database is up" for both maxapps and maximo. wait-for-it.sh also says that the port is up.

Is this a database issue where restoring is not recommended and/or needs to be modified somehow?

Thank you

@nishi2go
Copy link
Owner

Hi,
Do you find any detailed logs e.g. stack trace and/or SQL code? If there is any issue around restoring database, I think you have encountered any SQLException in your maximo logs.
Thanks.

@lhchang
Copy link
Author

lhchang commented Jun 1, 2020

Doing some more digging, it looks like upon each docker-compose up (at least the second time after a fresh build), the IP is changing for the database container - despite the hostname remaining maxdb.

MaxDB First startup:

"Name": "maximo-docker-v7611_maxdb_1",
                "EndpointID": "cc8613ee2f277081c7523d401a8d00b996b6dd0b221f46d8916a39d38a3a5281",
                "MacAddress": "02:42:ac:1a:00:03",
                "IPv4Address": "172.26.0.3/16",
                "IPv6Address": ""

After 'docker-compose stop' --> 'docker-compose up':

"Name": "maximo-docker-v7611_maxdb_1",
                "EndpointID": "025a986daec6041c313b0d0fff5d23a990d3178250da750a1b13cc95365363a8",
                "MacAddress": "02:42:ac:1a:00:02",
                "IPv4Address": "172.26.0.2/16",
                "IPv6Address": ""

Snippet of SystemOut.log:

[6/1/20 23:16:05:573 UTC] 00000079 SystemOut     O 01 Jun 2020 23:16:05:568 [ERROR] [] [] BMXAA6421E - The system could not connect to the JDBC source: jdbc:sqlserver://;serverName=172.26.0.3;databaseName=MAXDB76;portNumber=1433

Is this intended behavior? If I define static IP in the docker-compose.yml would it break anything?

Thank you

@nishi2go
Copy link
Owner

nishi2go commented Jun 2, 2020

Hi,

Yes, Docker dynamically defines IPs with internal DHCP like system by default. I recommend every component depends with host name, but I think static IPs will be working.

Reference: https://blog.alejandrocelaya.com/2017/04/21/set-specific-ip-addresses-to-docker-containers-created-with-docker-compose/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants