java个人常见异常

1.Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded

datasource could be configured.
Reason: Failed to determine suitable jdbc url
Action:
Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

   	-Dspring.profiles.active=dev

2.ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] -

openFile(/usr/xxx/logs/xxxxx.log,true) call failed. java.io.FileNotFoundException: /usr/xx/logs/xxxx.log(Permission denied)
    描述 sudo chown -R  user:staff namespace   user[用户角色]  staff [user的组]  namespace [文件夹]
    sudo chown -R  user:staff  opt
    或者  sudo chown -R $(whoami) /usr/local/

mac 容易报文件权限过低,提升权限
Failed to create parent directories for [/opt/log/mp.log] 
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file] - openFile(/opt/log/mp.log,true)

	解决:sudo chmod -R 777 /opt

3.Connection reset by peer的常见原因:

重新连接:客户端意外关闭的情况,不是发送指定指令通知服务器退出.
请求超出服务器并发最大连接数,服务器被迫关闭部分连接或服务器关闭连接依旧有请求

4.tomcat版本冲突

Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:175)

The following method did not exist:

    org.apache.tomcat.util.modeler.Registry.disableRegistry()V

The method's class, org.apache.tomcat.util.modeler.Registry, is available from the following locations:

    jar:file:/E:/mavenRepository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar!/org/apache/tomcat/util/modeler/Registry.class
It was loaded from the following location:
    file:/E:/mavenRepository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.apache.tomcat.util.modeler.Registry
Disconnected from the target VM, address: '127.0.0.1:63320', transport: 'socket'
Process finished with exit code 1
	
	解决:删除掉多余tomcat版本

5.Description:数据库url异常

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
	原因:数据库url错误

6.mybatis扫描

 No qualifying bean of type 'com.UserMapper' available: expected at 
 least 1 bean which qualifies as autowire candidate. Dependency 
 annotations: {@org.spring
 
 解决:@MapperScan({"正确的地址"})

7.java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/usr/logs/APPLICATION_NAME_IS_UNDEFINED.log,true) call failed. java.io.FileNotFoundException: /usr/logs/APPLICATION_NAME_IS_UNDEFINED.log (Read-only file system)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)

sudo mount -uw /

8.mysql Field ‘id’ doesn’t have a default value

	未设置主键自增

9.mysql Incorrect integer value: ‘’ for column ‘id’ at row 1

 id不能为空
 1.my.ini中查找sql-mode 并修改为sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
 2.将insert...字段写全 如: INSERT INTO USER(`name`, `age`, `sex`, `create_date`, `update_date`, `status` ) VALUES('a' + i,  i,'男' , NOW(), NOW(), 0 );

10.mysql Column count doesn’t match value count at row 1

属性数量和参数值数量不匹配

11.mysql 1292 - Truncated incorrect DOUBLE value: ‘锤子’, Time: 0.000000s

SQL语句在拼接字符串时使用函数CONCAT()而不要用“+”
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值