java.lang.IllegalStateException: 非法訪問:此Web應用程序實例已停止。查看日誌發現日誌報錯MySQL表不存在,實際上表已經存在。

java.lang.IllegalStateException: 非法訪問:此Web應用程序實例已停止。查看日誌發現日誌報錯mysql下表不存在,實際上表已經存在。

報錯如下:

java.lang.IllegalStateException: 非法訪問:此Web應用程序實例已停止。無法加載[]。爲了調試以及終止導致非法訪問的線程,將拋出以下堆棧跟蹤。
		at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1385)
		at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1038)
		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)

查看日誌:

Caused by: java.sql.SQLSyntaxErrorException: Table 'xxx.MYUSER' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:975)
	at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:392)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:59)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:73)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:60)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)

實際上MySQL中是有MYUSER。

產生原因:MySQL因爲操作系統的原因表名大小寫敏感

解決辦法

Windows系統在MySQL的安裝目錄下的my.ini文件中的[mysqld]下設置lower_case_table_names=0,該屬性爲0時表示大小寫敏感,爲1時表示大小寫不敏感,windows下默認爲1,Linux下默認爲0,Linux的MySQL默認配置文件在/etc/my.cnf

此處就是通過docker安裝MySQL,在Windows下用連接工具連接與查詢的時候報錯表不存在,所以需要進Linux修改lower_case_table_names值爲1,忽略大小寫。

發佈了35 篇原創文章 · 獲贊 13 · 訪問量 8526
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章