错误和解决方法都是亲自验证过的,解决方法可以用!不断更新中。
java.sql.SQLException: Unexpected exception encountered during query.
解决方法:
更换使用新版的mysql-connector-java即可。
MYSQL插入中文显示乱码。
解决方法:
修改my.ini文件的编码为UTF8,步骤如下:
windows中没有mysql服务。
解决方法:
(注意:计算机右键-管理-服务和应用管理-服务中查看MYSQL服务名称,有些MYSQL服务名是“MYSQL80”)
开始->运行->cmd,进到mysql安装的bin目录
D:\MySQL\bin>mysqld.exe -install
Service successfully installed.
这个时候刷新服务列表mysql就出现了,启动就可以了,或者可以直接在cmd中做如下操作
D:\MySQL\bin>net start mysql
Client does not support authentication protocol requested by server; consider upgrading MySQL client
解决方法:
在MYSQL中执行如下语句
USE mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '831015';
FLUSH PRIVILEGES;
Unknown initial character set index ‘255’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property.
解决方法一:
参照如下URL进行修改
String url = "jdbc:mysql://localhost:3306/db_cjky?useUnicode=true&characterEncoding=utf8";
解决方法二:
在url的链接后面增加
?useSSL=false&serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf-8
Communications link failure
解决方法:
参照第五条错误去解决
java.sql.SQLException: Unknown system variable ‘tx_isolation’
解决方法:
mysql-connector-java版本太低,更新到高版本即可。
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后面加上serverTimezone=GMT,如果需要使用gmt+8时区,需要写成GMT%2B8
?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8
WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
解决方法:
在mysql连接字符串url中加入ssl=true或者false即可
?useSSL=false
解决方法:
有可能是XML配置文件中的URL书写错误,URL中的“&”需要用“&”表示。
eclipse项目显示红色感叹号
解决方法:
由于缺少 jar 包引起的,按照如下流程删掉对应的无效包:
Eclipse没有Build Path 的解决方法
解决方法:
Window ->show view 选择package explorer
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (rat-
check) on project maven-model: Too many files with unapproved license: 1 See RAT
report in: E:\java\maven\app\target\rat.txt -> [Help 1]
解决办法:
在每个新建的类的第一行加入以下内容即可
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
Eclipse执行mvn install错误
解决办法:
尝试更换jdk版本
在eclipse使用了Maven,在使用自动生成代码时提示如下错误
the resource is not on the build path of a java project
解决方法一:(推荐)
此问题是因为eclipse在默认的源码存放路径下没有找到对应的java文件导致。可以把对应的java文件移动到对应的目录下。通常java文件需要放在:
src/main/java/
解决方法二:
此问题是因为eclipse在默认的源码存放路径下没有找到对应的java文件导致。可以更改java源码存放位置
右键—>Properties—>Java Build Path 上找到Source选项卡,里面修改源码存放位置即可。
Eclipse中JSTL的uri属性无法自动补全。
解决方法:
在JSP页面中添加<%@ taglib prefix=“fmt” uri=“http://java.sun.com/jsp/jstl/fmt” %>后就报错。错误提示:
Unable to convert string [] to class [java.util.Date] for attribute [value]: [Property Editor not registered with the PropertyEditorManager]
解决方法:
检查JSP文件中跟jstl相关的代码,不能有语法错误,即便是注释的内容也必须语法正确。把语法错误的代码删掉即可。
Eclipse中@Resource注解时提示错误
解决方法:
手动导入javax.annotation.Resource即可
Esclipse中使用自动补全命令不能显示对应的提示。
解决方法:
菜单:Window -> Preferences -> General -> Editors -> File Associations
在右侧点击“add”按钮,添加“.xml”。
然后在下方选择“Associated editors”处选择“XML Editor (default)…”,再点击右侧“Deafult”按钮,确定即可
从数据库中取出Timestamp格式数值,返回给JSP页面,提示如下错误:
org.apache.jasper.JasperException: Unable to convert string [${dept.create_time }] to class [java.util.Date] for attribute [value]: [Property Editor not registered with the PropertyEditorManager]
解决方法:
在JSP顶部添加:
//指定JSP中的表达式被当成字符串处理
<%@ page isELIgnored="false"%>
Eclipse中无法自动提示类名。
解决方法:
参考资料:https://blog.csdn.net/hh775313602/article/details/70176531
http://dist.springsource.com/release/TOOLS/update/e4.3/
Core / Spring IDE
Extensions / Spring IDE
Integrations / Spring IDE
Resources / Spring IDE
XML没有预设的模板内容,例如mybatis的配置文件模板。
解决方法:
Eclipse中项目和Java Resource出现红叉。
解决方法:
JRE和项目配置的不一致导致。让如下方式修改:
如果执行以上三步还未解决,可以点击顶部菜单Windows-Show View-Other…
然后搜索Problems,打开这个Problems窗口可以看到具体的错误提示。
在XML文件(spring配置文件)中出现如下提示:
The prefix “p” for attribute “p:dataSource-ref” associated with an element type “bean” is not bound.
解决方法:
意思是没有定义前缀p的含义。在xml配置文件中加入如下内容即可:
xmlns:p="http://www.springframework.org/schema/p"
提示如下错误,xxxx处为各式各样的内容。
java.io.UnsupportedEncodingException: xxxx
解决方法:
出现这种错误提示,表示传递的解码格式名称有误。xxxx位置填写的应该是正确编码的名称。
spring+mybatis。出现如下错误提示:
Caused by: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.qqfh.bookshop.repository.BookMapper.getAll’. It’s likely that neither a Result Type nor a Result Map was specified.
解决方法:
意思是有返回结果的查询没有设置返回对象。在有返回结果的查询中中添加如下内容即可:
resultType="Article"
在32位系统通过MSI安装MYSQL的8以上版本时,没有mysql server安装。只有其他插件安装成功。
解决方法:
MYSQL 8版本只有一个64位的安装包,里面没有mysql server安装。使用mysql 5版本的32位即可。
执行“git commit -am ‘first commit init project’”后提示错误:
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'JUNHONG@JUNHONG-PC.(none)')
解决方法:
找到工程目录 (Project)的.git文件夹,打开之后找到config文件,在最后边加上如下内容
[user]
email=your email
name=your name
在Eclipse的Servers添加项目时,没有出现想要添加的项目。
解决方法:
右键项目-properties-选择“Project Facets”-在右边勾选“Dynamic Web Module”和“JavaScript”即可
(如果勾选后没有出现version列,可以确定后重新进入这个界面即可)
可能出现的问题:JSP页面有红叉,请参照三十解决。
JSP页面和项目出现红叉。
解决方法:
使用spring mabatis时,错误提示内容如下:
严重: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException
解决方法:
service实现类中,mapper的注入错误,使用@Autowired注入即可。
nginx配置后,访问配置的域名,一直显示nginx的首页。
解决方法:
配置错误,检查配置
错误提示:
严重: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: java.util.HashMap cannot be cast to com.qqfh.pojo.Cart] with root cause
java.lang.ClassCastException: java.util.HashMap cannot be cast to com.qqfh.pojo.Cart
解决方法:
MyBatis的配置错误,返回结果应该是对象类型,而不是map类型。
本地使用Maven编译打包正常,但是项目上传到服务器之后,编译打包提示错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project qqfh: Compilation failure
[ERROR] /developer/git-repository/MALL/src/main/java/com/qqfh/service/impl/CartServiceImpl.java:[7,16] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
解决方法:
没有配置服务器上的仓库。在Maven目录下的conf/文件下,编辑settings.xml文件,修改如下内容,保存即可:
alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central
出现如下错误提示:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') tmp_count' at line 12
解决方法
表示SQL语句错误,需要检查SQL语句。tmp_count是pageHelper所加上的内容。
如果执行npm run dist命令时出错,提示Cannot read property ‘properties’ of undefined
解决方法:
升级webpack-cli到3.1.1即可,执行命令:
npm i [email protected] -D
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm '
as appropriate to mark resolution, or use 'git commit -a'.
解决方法:
//还原到最近一次成功git pull的记录
git reset --hard FETCH_HEAD
git reset --hard origin/v2.0