Disable IPv6 caused Tomcat startup failure

100 Views Asked by At

Recently, I updated my website by installing Tomcat 8.0.3 on Ubuntu 22.04. I was only having trouble sending emails with Spring Boot. I tried Gmail, Outlook and Yandex to send via SMTP and encountered the same problem in all of them. While emails were sent smoothly with localhost, when I uploaded the WAR file, email sending requests were timing out. While researching this issue with Outlook settings configured, I suspected that Openssl was not able to connect via IPv6. Thereupon, I disabled the IPv6 connection by making changes to /etc/sysctl.conf. Openssl started to connect with both IPv6 and IPv4, but this time I encountered the 503 Service Unavailable error. I thought that resetting the /etc/sysctl.conf settings would fix this, but it didn't. Tomcat started to give errors at startup due to a problem that I thought was caused by the Spring application.

$ tail /opt/tomcat/logs/catalina.out
SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/website] registered the JDBC driver [org.sqlite.JDBC] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
INFO [localhost-startStop-8] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/ROOT
WARNING [localhost-startStop-8] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/2]
SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/2] registered the JDBC driver [org.sqlite.JDBC] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

These are the statuses of the ports:

$ sudo netstat -anltp | grep LISTEN
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      229/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      361039/sshd: /usr/s
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      520099/sshd: user@p
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      520146/sshd: user@p
tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN      520207/sshd: user@p
tcp        0      0 127.0.0.1:6013          0.0.0.0:*               LISTEN      520317/sshd: user@p
tcp6       0      0 :::8080                 :::*                    LISTEN      520261/java
tcp6       0      0 :::80                   :::*                    LISTEN      370771/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      361039/sshd: /usr/s
tcp6       0      0 ::1:6010                :::*                    LISTEN      520099/sshd: user@p
tcp6       1      0 :::8443                 :::*                    LISTEN      520261/java
tcp6       0      0 ::1:6011                :::*                    LISTEN      520146/sshd: user@p
tcp6       0      0 :::443                  :::*                    LISTEN      370771/apache2
tcp6       0      0 ::1:6012                :::*                    LISTEN      520207/sshd: user@p
tcp6       0      0 ::1:6013                :::*                    LISTEN      520317/sshd: user@p
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      520261/java
tcp6       0      0 ::1:8009                :::*                    LISTEN      520261/java

How can I fix this situation? Any idea will be appreciated.

Installed versions: Spring/4.0.1, openjdk/1.8.0_382, Apache/2.4.52, OpenSSL/3.0.2

UPDATE: My project was prepared in Tomcat 7. I found out that the antiJARLocking attribute has been replaced by antiResourceLocking in Tomcat 8. When I made the change in the context.xml file, Tomcat started without any problems. Then I made soft reboot of my vps server. Thus, the website became online.

0

There are 0 best solutions below