title: How to fix error "this web application instance has been stopped already. Could not load []"
body: <p>I used to work for glassfish. Switched to tomee. It turns out this error, what is the problem? I did everything according to the instructions and I do not know what the reason.</p>
  
  <p>This is server.xml:</p>
  
  <pre><code>&lt;Resource name="jdbc/chessman_work" 
                auth="Container" 
  
                type="javax.sql.DataSource" 
                driverClassName="com.mysql.cj.jdbc.Driver"
                classpath="${basedir}/lib/mysql-connector.jar" 
  
                url="jdbc:mysql://localhost:3306/chessman_work?zeroDateTimeBehavior=CONVERT_TO_NULL&amp;amp;serverTimezone=UTC&amp;amp;useSSL=false"
  
                username="root" 
                password="root"
  
                maxActive="100" 
                maxIdle="30" 
                maxWait="10000" /&gt;
  </code></pre>
  
  <p>context.xml:</p>
  
  <pre><code>&lt;Context&gt;
  
      &lt;!-- Default set of monitored resources. If one of these changes, the    --&gt;
      &lt;!-- web application will be reloaded.                                   --&gt;
      &lt;WatchedResource&gt;WEB-INF/web.xml&lt;/WatchedResource&gt;
      &lt;WatchedResource&gt;WEB-INF/tomcat-web.xml&lt;/WatchedResource&gt;
      &lt;WatchedResource&gt;${catalina.base}/conf/web.xml&lt;/WatchedResource&gt;
      &lt;ResourceLink name="jdbc/chessman_work" global="jdbc/chessman_work" auth="Container" type="javax.sql.DataSource" /&gt;
      &lt;!-- Uncomment this to disable session persistence across Tomcat restarts --&gt;
      &lt;!--
      &lt;Manager pathname="" /&gt;
      --&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>12-Jan-2019 12:59:37.210 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Server startup in 25381 ms
  12-Jan-2019 12:59:37.656 INFO [http-nio-8080-exec-6] org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState.stop HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/chessman_work?zeroDateTimeBehavior=CONVERT_TO_NULL&amp;serverTimezone=UTC&amp;useSSL=false]
  12-Jan-2019 12:59:37.675 INFO [http-nio-8080-exec-6] org.apache.openejb.assembler.classic.Assembler.destroyApplication Undeploying app: F:\Developer\Programms\Chessman\ChessmanWork\target\ChessmanWork
  12-Jan-2019 12:59:38.088 WARNING [http-nio-8080-exec-6] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ChessmanWork] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
  12-Jan-2019 12:59:38.090 WARNING [http-nio-8080-exec-6] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ChessmanWork] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   java.lang.Object.wait(Native Method)
   java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
   com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:70)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   java.lang.Thread.run(Thread.java:748)
  12-Jan-2019 12:59:38.607 INFO [http-nio-8080-exec-6] sun.reflect.DelegatingMethodAccessorImpl.invoke Undeploying context [/ChessmanWork]
  12-Jan-2019 12:59:38.651 INFO [http-nio-8080-exec-3] sun.reflect.DelegatingMethodAccessorImpl.invoke Deploying deployment descriptor [F:\Servers\apache-tomee-plume-8.0.0-M1\conf\Catalina\localhost\ChessmanWork.xml]
  12-Jan-2019 12:59:38.658 WARNING [http-nio-8080-exec-3] sun.reflect.NativeMethodAccessorImpl.invoke The path attribute with value [/ChessmanWork] in deployment descriptor [F:\Servers\apache-tomee-plume-8.0.0-M1\conf\Catalina\localhost\ChessmanWork.xml] has been ignored
  12-Jan-2019 12:59:38.660 INFO [http-nio-8080-exec-3] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -&gt; /ChessmanWork
  12-Jan-2019 12:59:38.838 INFO [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
   java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. 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:1329)
      at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1006)
      at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
      at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>