JavaWeb項目(JSP+JavaBean+Servlet+Dao+MySQL)中常出現的錯誤總結(一)

JavaWeb項目(JSP+JavaBean+Servlet+Dao+MySQL)中常出現的錯誤總結:

  1. 錯誤:NO timezone mapping entry for ‘Gmt 8’ 或:The server time zone
    value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one
    修改:在JDBC連接的URL後面添加:&serverTimezone=UTC
    如:jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&ser verTimezone=UTC&useSSL=true

    錯誤:javax.servlet.ServletException: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.
    改正:在URL後面部分添加:useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

  2. 錯誤:No data sources are configured to run this sql 或 No data sources are configured to run this SQL and provide advanced code assistance.
    改正:配置MySQL

  3. 問題:cannot resolve method getParameter(Java.lang.String)
    改正:添加tomcat

左上角點擊“File”----->Project Structure;
新出現對話框點擊“Modules”---->“+”---->“Library 或 Module Dependency…”;
彈出對話框,選擇tomcat----->點擊“Add Selected” ;
點擊“Apply”---->“OK”。

  1. 錯誤:Cannot resolve symbol ‘servlet’
    改正:項目->右鍵、Open Module
    Settings->Libraries->右邊加號->找到本地Tomcat目錄libs下的setvlet-api.jar包,添加其中。

  2. 錯誤:Cannot resolve symbol ‘servlet’
    改正:項目->右鍵、Open Module Settings->Libraries->右邊加號->找到本地Tomcat目錄libs下的setvlet-api.jar包,添加其中。

  3. 錯誤:There is no configured/running web-servers found!Please,run any wen-configuration and hit the Refresh button!
    在這裏插入圖片描述
    改正:在瀏覽器中打開相應的網址,利用網站地址直接訪問。
    如:http://localhost:8080/ssm/user/findAllUser.do#

  4. 錯誤:Can’t connect to MySQL server on ‘localhost’(0)
    改正:利用可視化工具(如Navicat、SQLyog)直接創建MySQL的連接有時會報錯,原因是電腦中未打開MySQL。需要在cmd下以管理員的命令打開,先使用mysqld -install mysql命令進行初始化,在使用net start mysql啓動MySQL服務。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章