添加@enableeurekaserver启动报错_报错集

报错集

java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

原因

使用PreparedStatement时,like子句的问号多打了单引号。

String 

修改

将单引号去掉。

String 

java.sql.BatchUpdateException: Duplicate entry '运营部10' for key 'department_name'

原因

dept = new Departments();没有放到循环中,导致添加的都是同一个对象,触发唯一性约束。

List

修改

将dept = new Departments();放到循环中

List

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

原因

缺少commons-logging-1.2.jar包

修改

导入commons-logging-1.2.jar包

警告:Establishing SSL connection without server's identity verification is not recommended

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在高版本需要指明是否进行SSL连接。 在mysql连接字符串url中加入ssl=true或者false即可:

<property 

The reference to entity "characterEncoding" must end with the ';' delimiter.

原因:“&”,在xml中这个是读不出的,正确写法将“&”转义“&”:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8
&amp;characterEncoding=UTF-8

前言不允许有内容

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。

mybatis绑定方案

Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.trf.mapper.UserMapper.selALL

原因,接口方法名与配置id不一致

org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.trf.mapper.StudentMapper.

原因,mapper配置文件中的resultMap属性没有填写

Error updating database. Cause: java.lang.NumberFormatException: For input string: "{0=null}"

在标签中接收参数的时候test中去掉#{}直接写上参数的名称就可以了也是一样

java.lang.NoSuchMethodException: com.trf.servlet.DeptServlet.addDept(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

现象:BaseServlet中已经正确取到方法名,但是仍然报错

原因:DeptServlet中的addDept方法写成了protected而不是public

解决:改成public即可

Invalid bound statement (not found)

原因

  1. 检查xml文件所在package名称是否和Mapper interface所在的包名
<mapper namespace="me.tspace.pm.dao.UserDao">

mapper的namespace写的不对!!!注意修改。

  1. UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此
  2. UserDao的方法返回值是List,而select元素没有正确配置ResultMap,或者只配置ResultType!
  3. 如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决
  4. 看下mapper的XML配置路径是否正确

Cause: java.lang.ClassNotFoundException: Cannot find class: employee

现象:服务器正常启动,只要调用Dao层就会报错

原因:别名配置不正确

42e734264e0b814da869d989272f918a.png

解决,正确配置别名包

a867fa8d4443356b21746c38c8958a2d.png

org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected 'com.trf.dao.EmployeeDao' but found 'com.trf.dao.Employee'.

现象:服务器正常启动,只要调用Dao层就会报错

原因:命名空间配置错误

1d7196fa06dda088403cd151d77825fd.png

解决:正确配置命名空间

90e4cd58d4fe1e088464dd5c8786fb12.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值