JAVAWEB

【 MyBatis - maven项目 - 调用代理Dao中的方法时-执行错误 】

【1】
  报错:    org.apache.ibatis.exceptions.PersistenceException:   ### Error querying database.    Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:   Client does not support authentication protocol requested by server; consider upgrading MySQL client    ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:    Client does not support authentication protocol requested by server; consider upgrading MySQL client    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:   Client does not support authentication protocol requested by server; consider upgrading MySQL client 原因:MySQL数据库版本为
8点多 - 数据库驱动位 5点多,这个驱动不行了 解决:pom.xml中重新设置 MySQL驱动版本8.多,
【2】
报错:“经过(1)修改后新的问题” Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 原因:`com.mysql.jdbc.Driver'过时了,用com.mysql.cj.jdbc.Driver;
【3】
报错: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLException: The server time zone value
'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)
to use a more specifc time zone value
if you want to utilize time zone support. ### Cause: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)
to use a more specifc time zone value
if you want to utilize time zone support. Caused by: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)
to use a more specifc time zone value
if you want to utilize time zone support. Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)
to use a more specifc time zone value
if you want to utilize time zone support. 原因分析:   根据报错我们知道这是时间报错,   没有指定明确的时区,    是因为新版的mysql会询问是否SSL连接,返回一个Boolean值,我们需要手动指定true或者false。 解决:
所以再次更改配置文件中的 url 满足其要求即可,如下:
jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useSSL=false -- 会有问题 & 后加[amp]???为啥?,若配置到properties文件中就没事??
    可能在url中加入的条件: characterEncoding=utf-8 ;serverTimezone=UTC ;useSSL=false  ;&allowPublicKeyRetrieval=true
【4】
报错:Public Key Retrieval is not allowed 原因:MySQL 8 版本问题 ?,原因未知 ! 解决:url中加上 &allowPublicKeyRetrieval=true

【  web.xml - maven项目 

【1】  
报错: Multiple annotations found at this line:

    报错前的行为:在web.xml中配置filter <web-app>标签就变红;

可能:(1)有的地方多了空格,或者多了标点;- 找到并删了 (2)开头的 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > 符合xml规范,但不符合web-app_2_3.dtd的规范 => 导致在设置filter中一配置filter就出现红色警告,当然不管他,程序仍然可执行;(强迫症:不能看见红色) 解决: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
           删了就不报错,但有警告。
- 尝试ok

(3)严格按照 (icon?,display-name?,description?,distributable?,context-param*, filter*,filter-mapping*, listener*,servlet*, servlet-mapping*, session-config?,mime-mapping*, welcome-file-list?,error-page*,taglib*, resource-env-ref*,resource-ref*, security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*) 顺序写web.xml中的标签。 - 尝试ok

【   SpringMVC - maven项目  】

【1】
报错: No mapping found
for HTTP request with URI [/classroomsmanagement/login.html] in DispatcherServlet with name 'dispatcherServlet' 原因分析: springMVC对要访问的html进行拦截了 而,只在springMVC配置文件配置了不对js,css,img 静态资源不拦截; 解决: 在springMVC.xml中设置对html这种静态资源不拦截;
【2】
问题:在springMVC框架中,controller返回ajax时数据中文乱码;controller中数据正常,ajax接受到时为乱码; 解决:@RequestMapping() 加入属性参数produces
= {"application/json;charset=UTF-8"}

【  Tomcat 启动时 - Maven项目  】

【1】
报错: 信息: 非法访问:此Web应用程序实例已停止。无法加载[]。为了调试以及终止导致非法访问的线程,将抛出以下堆栈跟踪。 解决: 方法1:重新启动tomcat和apache后问题解决了,tomcat正在缓存应用程序的旧版本。
- 尝试ok;
   方法2: 不管他,也没事
原文地址:https://www.cnblogs.com/floakss/p/12639470.html