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服务。


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