I am building a Spring Boot application with a MongoDB database and I am running into an issue when the application is deployed to the server and starts logging. I have done some digging on the internet and all the answer I am getting is that I need the following maven dependency and to do an install. I have done that and unfortunately the issue still remains.
I am currently using MongoDB version 4.4.11 and Spring-boot version 2.6.1
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myproject</groupId>
<artifactId>backend</artifactId>
<version>3.2.0.RELEASE</version>
</parent>
<artifactId>pe</artifactId>
<packaging>war</packaging>
<name>myproject Backend Pe</name>
<dependencies>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>core</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>
<start-class>com.myproject.mobileplatform_backend.app.Application</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>pe</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<!-- installs node modules -->
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${basedir}/src/main/frontend</workingDirectory>
</configuration>
</execution>
<!-- builds frontend -->
<execution>
<id>angular build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>ng</executable>
<arguments>
<argument>build</argument>
<argument>--prod</argument>
<argument>--deploy-url</argument>
<argument>dist/</argument>
</arguments>
<workingDirectory>${basedir}/src/main/frontend</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Readout from localhost..log:
14-Jan-2022 11:41:57.058 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
14-Jan-2022 11:42:15.809 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializer detected on classpath
14-Jan-2022 11:42:24.270 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
14-Jan-2022 11:42:32.293 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [errorPageSecurityFilter]
java.lang.AbstractMethodError
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1842)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
14-Jan-2022 11:42:32.323 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
Errors when deploying to server:
Exception in thread "cluster-ClusterId{value='61dde73d6257ab22798db558', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.info(Logger.java:595)
at com.mongodb.diagnostics.logging.SLF4JLogger.info(SLF4JLogger.java:76)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.logStateChange(DefaultServerMonitor.java:266)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:164)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1301)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1158)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
... 8 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1311)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1299)
... 10 more
Exception in thread "cluster-ClusterId{value='61dde7416257ab22798db559', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.info(Logger.java:595)
at com.mongodb.diagnostics.logging.SLF4JLogger.info(SLF4JLogger.java:76)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.logStateChange(DefaultServerMonitor.java:266)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:164)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "cluster-ClusterId{value='61dde7416257ab22798db55a', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.info(Logger.java:595)
at com.mongodb.diagnostics.logging.SLF4JLogger.info(SLF4JLogger.java:76)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.logStateChange(DefaultServerMonitor.java:266)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:164)
at java.lang.Thread.run(Thread.java:745)
Second Error:
Exception in thread "cluster-ClusterId{value='61e1a55b4e705712d5c92121', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: com/mongodb/internal/connection/DecimalFormatHelper
at com.mongodb.connection.ServerDescription.getRoundTripFormattedInMilliseconds(ServerDescription.java:1041)
at com.mongodb.connection.ServerDescription.getShortDescription(ServerDescription.java:1016)
at com.mongodb.connection.ClusterDescription.getShortDescription(ClusterDescription.java:327)
at com.mongodb.internal.connection.BaseCluster.updateDescription(BaseCluster.java:245)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:125)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:116)
at com.mongodb.internal.connection.SingleServerCluster.access$200(SingleServerCluster.java:41)
at com.mongodb.internal.connection.SingleServerCluster$DefaultServerDescriptionChangedListener.serverDescriptionChanged(SingleServerCluster.java:107)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.updateDescription(DefaultSdamServerDescriptionManager.java:127)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.update(DefaultSdamServerDescriptionManager.java:81)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:165)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [com.mongodb.internal.connection.DecimalFormatHelper]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1301)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1158)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
... 12 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mongodb.internal.connection.DecimalFormatHelper]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1311)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1299)
... 14 more
Exception in thread "cluster-ClusterId{value='61e1a55c4e705712d5c92122', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: com/mongodb/internal/connection/DecimalFormatHelper
at com.mongodb.connection.ServerDescription.getRoundTripFormattedInMilliseconds(ServerDescription.java:1041)
at com.mongodb.connection.ServerDescription.getShortDescription(ServerDescription.java:1016)
at com.mongodb.connection.ClusterDescription.getShortDescription(ClusterDescription.java:327)
at com.mongodb.internal.connection.BaseCluster.updateDescription(BaseCluster.java:245)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:125)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:116)
at com.mongodb.internal.connection.SingleServerCluster.access$200(SingleServerCluster.java:41)
at com.mongodb.internal.connection.SingleServerCluster$DefaultServerDescriptionChangedListener.serverDescriptionChanged(SingleServerCluster.java:107)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.updateDescription(DefaultSdamServerDescriptionManager.java:127)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.update(DefaultSdamServerDescriptionManager.java:81)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:165)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "cluster-ClusterId{value='61e1a5544e705712d5c92120', description='null'}-localhost:27017" java.lang.NoClassDefFoundError: com/mongodb/internal/connection/DecimalFormatHelper
at com.mongodb.connection.ServerDescription.getRoundTripFormattedInMilliseconds(ServerDescription.java:1041)
at com.mongodb.connection.ServerDescription.getShortDescription(ServerDescription.java:1016)
at com.mongodb.connection.ClusterDescription.getShortDescription(ClusterDescription.java:327)
at com.mongodb.internal.connection.BaseCluster.updateDescription(BaseCluster.java:245)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:125)
at com.mongodb.internal.connection.SingleServerCluster.publishDescription(SingleServerCluster.java:116)
at com.mongodb.internal.connection.SingleServerCluster.access$200(SingleServerCluster.java:41)
at com.mongodb.internal.connection.SingleServerCluster$DefaultServerDescriptionChangedListener.serverDescriptionChanged(SingleServerCluster.java:107)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.updateDescription(DefaultSdamServerDescriptionManager.java:127)
at com.mongodb.internal.connection.DefaultSdamServerDescriptionManager.update(DefaultSdamServerDescriptionManager.java:81)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:165)
at java.lang.Thread.run(Thread.java:745)