Error: org.springframework.jdbc.CannotGetJdbcConnectionException: The Network Adapter could not establish the connection

Solution for Error: org.springframework.jdbc.CannotGetJdbcConnectionException: The Network Adapter could not establish the connection
is Given Below:

I’m currently running a Spring application through Netbeans on my Apache Tomcat server. However, whenever I try to deploy it to the server, it gives me a blank page on the site, and the trace gives me back the following error.

2021-07-30 13:49:29,590 [http-nio-8080-exec-5] DEBUG (AbstractApplicationContext.java:272) Publishing event in context [o[email protected]d60c903]: ServletRequestHandledEvent: url=[/vendor-portal/Login.html;jsessionid=E6EC56451EDB00F325F11D16009D5FFF]; client=[0:0:0:0:0:0:0:1]; method=[GET]; servlet=[SiteAdmin]; session=[E6EC56451EDB00F325F11D16009D5FFF]; user=[null]; time=[2682ms]; status=[failed: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Io exception: The Network Adapter could not establish the connection]
2021-07-30 13:49:29,591 [http-nio-8080-exec-5] DEBUG (AbstractApplicationContext.java:272) Publishing event in context [o[email protected]e7b8ad8]: ServletRequestHandledEvent: url=[/vendor-portal/Login.html;jsessionid=E6EC56451EDB00F325F11D16009D5FFF]; client=[0:0:0:0:0:0:0:1]; method=[GET]; servlet=[SiteAdmin]; session=[E6EC56451EDB00F325F11D16009D5FFF]; user=[null]; time=[2682ms]; status=[failed: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Io exception: The Network Adapter could not establish the connection]
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

The jdbc driver does not seem to be able to connect to the necessary database. I’ve already checked the url and credentials in the jdbc.properties file, and they are correct.

I’ve also confirmed that I am able to connect to the database just fine using SQLDeveloper. So whatever the problem is, it must be related to either my app or server.

Any help or advice that can be provided is appreciated

UPDATE: A user told me to include the output of netstat to show what ports are being listened to.

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:5040           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:5357           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:33060          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:45556          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49664          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49667          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49673          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49694          0.0.0.0:0              LISTENING
  TCP    10.64.140.111:139      0.0.0.0:0              LISTENING
  TCP    10.64.140.111:49219    162.247.243.147:443    ESTABLISHED
  TCP    10.64.140.111:49754    104.18.21.134:443      ESTABLISHED
  TCP    10.64.140.111:50305    172.217.164.232:443    ESTABLISHED
  TCP    10.64.140.111:51074    104.18.21.134:443      ESTABLISHED
  TCP    10.64.140.111:51089    142.251.4.156:443      TIME_WAIT
  TCP    10.64.140.111:51795    104.16.167.35:443      ESTABLISHED
  TCP    10.64.140.111:52139    104.16.65.85:443       ESTABLISHED
  TCP    10.64.140.111:52685    99.84.248.214:443      ESTABLISHED
  TCP    10.64.140.111:53503    199.232.37.188:443     ESTABLISHED
  TCP    10.64.140.111:53735    3.17.222.216:443       ESTABLISHED
  TCP    10.64.140.111:54984    206.19.49.186:443      ESTABLISHED
  TCP    10.64.140.111:56228    99.84.174.69:443       ESTABLISHED
  TCP    10.64.140.111:56959    3.231.47.171:443       ESTABLISHED
  TCP    10.64.140.111:56961    52.42.20.36:8883       ESTABLISHED
  TCP    10.64.140.111:57167    104.18.21.134:443      TIME_WAIT
  TCP    10.64.140.111:57877    3.17.222.216:443       ESTABLISHED
  TCP    10.64.140.111:57879    104.16.65.85:443       ESTABLISHED
  TCP    10.64.140.111:57922    172.217.164.194:443    ESTABLISHED
  TCP    10.64.140.111:58060    104.18.21.134:443      TIME_WAIT
  TCP    10.64.140.111:58393    199.232.37.27:443      ESTABLISHED
  TCP    10.64.140.111:58801    157.185.170.217:443    ESTABLISHED
  TCP    10.64.140.111:59941    99.84.253.60:443       ESTABLISHED
  TCP    10.64.140.111:59948    52.226.139.185:443     ESTABLISHED
  TCP    10.64.140.111:59964    54.191.40.225:443      TIME_WAIT
  TCP    10.64.140.111:59965    54.191.40.225:443      TIME_WAIT
  TCP    10.64.140.111:59966    34.208.93.89:443       ESTABLISHED
  TCP    10.64.140.111:60046    54.236.103.189:443     ESTABLISHED
  TCP    10.64.140.111:60416    157.185.170.217:443    ESTABLISHED
  TCP    10.64.140.111:60424    89.187.178.102:443     ESTABLISHED
  TCP    10.64.140.111:61612    99.84.253.60:443       ESTABLISHED
  TCP    10.64.140.111:61789    199.232.37.27:443      ESTABLISHED
  TCP    10.64.140.111:61790    34.208.93.89:443       ESTABLISHED
  TCP    10.64.140.111:62263    13.249.87.124:443      ESTABLISHED
  TCP    10.64.140.111:62328    35.186.220.184:443     ESTABLISHED
  TCP    10.64.140.111:63133    54.236.103.189:443     ESTABLISHED
  TCP    10.64.140.111:63598    172.217.164.225:443    ESTABLISHED
  TCP    10.64.140.111:63623    3.17.222.216:443       ESTABLISHED
  TCP    10.64.140.111:63661    99.84.248.214:443      ESTABLISHED
  TCP    10.64.140.111:64039    35.164.204.230:443     TIME_WAIT
  TCP    10.64.140.111:64040    40.91.72.120:443       ESTABLISHED
  TCP    10.64.140.111:64926    206.19.49.191:443      CLOSE_WAIT
  TCP    10.64.140.111:65481    35.174.127.31:443      ESTABLISHED
  TCP    127.0.0.1:4699         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:8005         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:27019        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:27019        127.0.0.1:53321        ESTABLISHED
  TCP    127.0.0.1:45556        127.0.0.1:55886        ESTABLISHED
  TCP    127.0.0.1:49706        127.0.0.1:49708        ESTABLISHED
  TCP    127.0.0.1:49708        127.0.0.1:49706        ESTABLISHED
  TCP    127.0.0.1:49709        127.0.0.1:49710        ESTABLISHED
  TCP    127.0.0.1:49710        127.0.0.1:49709        ESTABLISHED
  TCP    127.0.0.1:49742        127.0.0.1:65001        ESTABLISHED
  TCP    127.0.0.1:49756        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:49756        127.0.0.1:49795        ESTABLISHED
  TCP    127.0.0.1:49795        127.0.0.1:49756        ESTABLISHED
  TCP    127.0.0.1:49823        127.0.0.1:49824        ESTABLISHED
  TCP    127.0.0.1:49824        127.0.0.1:49823        ESTABLISHED
  TCP    127.0.0.1:49825        127.0.0.1:49826        ESTABLISHED
  TCP    127.0.0.1:49826        127.0.0.1:49825        ESTABLISHED
  TCP    127.0.0.1:49827        127.0.0.1:49828        ESTABLISHED
  TCP    127.0.0.1:49828        127.0.0.1:49827        ESTABLISHED
  TCP    127.0.0.1:49829        127.0.0.1:49830        ESTABLISHED
  TCP    127.0.0.1:49830        127.0.0.1:49829        ESTABLISHED
  TCP    127.0.0.1:49831        127.0.0.1:49832        ESTABLISHED
  TCP    127.0.0.1:49832        127.0.0.1:49831        ESTABLISHED
  TCP    127.0.0.1:49833        127.0.0.1:49834        ESTABLISHED
  TCP    127.0.0.1:49834        127.0.0.1:49833        ESTABLISHED
  TCP    127.0.0.1:49835        127.0.0.1:49836        ESTABLISHED
  TCP    127.0.0.1:49836        127.0.0.1:49835        ESTABLISHED
  TCP    127.0.0.1:49837        127.0.0.1:49838        ESTABLISHED
  TCP    127.0.0.1:49838        127.0.0.1:49837        ESTABLISHED
  TCP    127.0.0.1:49861        127.0.0.1:62522        ESTABLISHED
  TCP    127.0.0.1:50911        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:50912        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:52032        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:53321        127.0.0.1:27019        ESTABLISHED
  TCP    127.0.0.1:55886        127.0.0.1:45556        ESTABLISHED
  TCP    127.0.0.1:62522        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:62522        127.0.0.1:49861        ESTABLISHED
  TCP    127.0.0.1:65001        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:65001        127.0.0.1:49742        ESTABLISHED
  TCP    127.0.0.1:65486        127.0.0.1:65487        ESTABLISHED
  TCP    127.0.0.1:65487        127.0.0.1:65486        ESTABLISHED
  TCP    127.0.0.1:65490        127.0.0.1:65491        ESTABLISHED
  TCP    127.0.0.1:65491        127.0.0.1:65490        ESTABLISHED
  TCP    127.0.0.1:65492        127.0.0.1:65493        ESTABLISHED
  TCP    127.0.0.1:65493        127.0.0.1:65492        ESTABLISHED
  TCP    192.168.0.72:139       0.0.0.0:0              LISTENING
  TCP    192.168.0.72:49532     172.217.164.206:80     ESTABLISHED
  TCP    192.168.0.72:52070     65.243.45.138:443      ESTABLISHED
  TCP    192.168.0.72:52913     172.217.165.14:443     ESTABLISHED
  TCP    192.168.0.72:55126     216.239.38.21:443      ESTABLISHED
  TCP    192.168.0.72:55823     172.253.115.188:5228   ESTABLISHED
  TCP    192.168.0.72:58484     172.217.1.10:443       ESTABLISHED
  TCP    192.168.0.72:59017     172.217.1.3:443        ESTABLISHED
  TCP    192.168.0.72:59963     142.251.33.174:443     ESTABLISHED
  TCP    192.168.0.72:61960     172.217.164.206:80     ESTABLISHED
  TCP    192.168.0.72:64240     142.251.33.174:443     ESTABLISHED
  TCP    192.168.0.72:64664     173.223.108.63:443     CLOSE_WAIT
  TCP    192.168.0.72:65134     172.217.164.206:443    ESTABLISHED
  TCP    192.168.0.224:139      0.0.0.0:0              LISTENING
  TCP    192.168.56.1:139       0.0.0.0:0              LISTENING
  TCP    [::]:135               [::]:0                 LISTENING
  TCP    [::]:445               [::]:0                 LISTENING
  TCP    [::]:3306              [::]:0                 LISTENING
  TCP    [::]:5357              [::]:0                 LISTENING
  TCP    [::]:8080              [::]:0                 LISTENING
  TCP    [::]:33060             [::]:0                 LISTENING
  TCP    [::]:45556             [::]:0                 LISTENING
  TCP    [::]:49664             [::]:0                 LISTENING
  TCP    [::]:49665             [::]:0                 LISTENING
  TCP    [::]:49666             [::]:0                 LISTENING
  TCP    [::]:49667             [::]:0                 LISTENING
  TCP    [::]:49673             [::]:0                 LISTENING
  TCP    [::]:49694             [::]:0                 LISTENING
  TCP    [::1]:4699             [::]:0                 LISTENING
  TCP    [::1]:49678            [::]:0                 LISTENING
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49913  [2600:1404:6400:895::3114]:80  ESTABLISHED
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49914  [2600:1404:6400:895::3114]:80  ESTABLISHED
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49915  [2600:1404:6400:895::3114]:80  ESTABLISHED
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49916  [2600:1404:6400:895::3114]:80  ESTABLISHED
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49917  [2600:1404:6400:895::3114]:80  ESTABLISHED
  TCP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:49918  [2600:1404:6400:895::3114]:80  ESTABLISHED
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:5050           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5355           *:*
  UDP    0.0.0.0:51122          *:*
  UDP    0.0.0.0:51762          *:*
  UDP    0.0.0.0:52335          *:*
  UDP    0.0.0.0:52503          *:*
  UDP    0.0.0.0:55201          *:*
  UDP    0.0.0.0:55474          *:*
  UDP    0.0.0.0:55475          *:*
  UDP    0.0.0.0:55476          *:*
  UDP    0.0.0.0:55477          *:*
  UDP    0.0.0.0:56672          *:*
  UDP    0.0.0.0:57774          *:*
  UDP    0.0.0.0:58680          *:*
  UDP    0.0.0.0:58734          *:*
  UDP    0.0.0.0:58898          *:*
  UDP    0.0.0.0:63406          *:*
  UDP    0.0.0.0:64100          *:*
  UDP    10.64.140.111:137      *:*
  UDP    10.64.140.111:138      *:*
  UDP    10.64.140.111:1900     *:*
  UDP    10.64.140.111:2177     *:*
  UDP    10.64.140.111:5353     *:*
  UDP    10.64.140.111:52498    *:*
  UDP    127.0.0.1:1900         *:*
  UDP    127.0.0.1:10010        *:*
  UDP    127.0.0.1:10011        *:*
  UDP    127.0.0.1:51218        *:*
  UDP    127.0.0.1:52502        *:*
  UDP    127.0.0.1:62977        *:*
  UDP    127.0.0.1:64141        *:*
  UDP    192.168.0.72:137       *:*
  UDP    192.168.0.72:138       *:*
  UDP    192.168.0.72:1900      *:*
  UDP    192.168.0.72:2177      *:*
  UDP    192.168.0.72:5353      *:*
  UDP    192.168.0.72:52499     *:*
  UDP    192.168.0.224:137      *:*
  UDP    192.168.0.224:138      *:*
  UDP    192.168.0.224:1900     *:*
  UDP    192.168.0.224:2177     *:*
  UDP    192.168.0.224:5353     *:*
  UDP    192.168.0.224:52501    *:*
  UDP    192.168.56.1:137       *:*
  UDP    192.168.56.1:138       *:*
  UDP    192.168.56.1:1900      *:*
  UDP    192.168.56.1:2177      *:*
  UDP    192.168.56.1:5353      *:*
  UDP    192.168.56.1:52500     *:*
  UDP    [::]:3702              *:*
  UDP    [::]:3702              *:*
  UDP    [::]:3702              *:*
  UDP    [::]:3702              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5355              *:*
  UDP    [::]:52504             *:*
  UDP    [::]:55202             *:*
  UDP    [::]:58681             *:*
  UDP    [::1]:1900             *:*
  UDP    [::1]:5353             *:*
  UDP    [::1]:52497            *:*
  UDP    [2600:8804:8000:b500::8257]:2177  *:*
  UDP    [2600:8804:8000:b500::e123]:2177  *:*
  UDP    [2600:8804:8000:b500:10e2:25b5:75f6:b29b]:2177  *:*
  UDP    [2600:8804:8000:b500:edb2:48d9:7e3e:2715]:2177  *:*
  UDP    [fe80::10e2:25b5:75f6:b29b%7]:1900  *:*
  UDP    [fe80::10e2:25b5:75f6:b29b%7]:2177  *:*
  UDP    [fe80::10e2:25b5:75f6:b29b%7]:52494  *:*
  UDP    [fe80::69a5:a120:4fdb:81a%13]:1900  *:*
  UDP    [fe80::69a5:a120:4fdb:81a%13]:2177  *:*
  UDP    [fe80::69a5:a120:4fdb:81a%13]:52493  *:*
  UDP    [fe80::6c4b:a4e9:bd12:eb2a%6]:1900  *:*
  UDP    [fe80::6c4b:a4e9:bd12:eb2a%6]:2177  *:*
  UDP    [fe80::6c4b:a4e9:bd12:eb2a%6]:52496  *:*
  UDP    [fe80::ba54:4c77:3ef2:8009%13]:2177  *:*
  UDP    [fe80::f0e4:2896:3b2f:1423%19]:1900  *:*
  UDP    [fe80::f0e4:2896:3b2f:1423%19]:2177  *:*
  UDP    [fe80::f0e4:2896:3b2f:1423%19]:52495  *:*

I’m not really familiar with netstat so I just included everything it gave me.

Also, I have my Tomcat server set up on port 8080. I’m running Windows 10. And I can’t show jdbc properties because i’m doing this project for someone else. I can confirm however that the credentials therein are correct.

Figured it out, just had to add a “.com” to the host name