原因:MySQL中的sql_mode属性中有only_full_group_by属性
only_full_group_by属性:Mysql的5.7.x版本中默认是开启sql_mode = only_full_group_by。而在这个模式下,我们使用分组查询时,出现在select字段后面的只能是group by后面的分组字段,或使用聚合函数包裹着的字段。
bug
Error querying database. Cause: java.sql.SQLException: Data truncated for column ‘getChildIdList(0)’ at row 1Error querying database.
解决方法:
SELECT @@sql_mode;
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SET sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
JSON parse error: Cannot deserialize instance of `java.util.ArrayList` out of VALUE_STRING token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of VALUE_STRING token
at [Source: (PushbackInputStream); line: 1, column: 77] (through reference chain: com.gxxw.video.vo.device.DeviceSaveRequestParam["groupId"])
解决问题:
将JSON类型修改成一致
bug
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/gxxw/video/modules/from/home/socket/WebSocketConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:119)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 24 common frames omitted
Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
at org.springframework.util.Assert.state(Assert.java:73)
at org.springframework.web.socket.server.standard.ServerEndpointExporter.afterPropertiesSet(ServerEndpointExporter.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
... 39 common frames omitted
问题解决:
在@SpringBootTest
加入属性webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
原因:
bug
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication....
修改版本到最新
bug:无法刷新,不启动idea一样可以访问
原因:可能是因为项目没有完全关闭Java(TM)Platform SE binary
解决方法:打开任务管理器找到多余的Java(TM)Platform SE binary,结束,就可以解决问题
原因:没有修改xxxMapper.xml中的路径,导致dao接口找不到该方法,无效的绑定语句(未找到):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.video_analy.modules.schedule.dao.ScheduleJobDao.updateBatch
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:49)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedMapperMethod$0(MybatisMapperProxy.java:65)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedMapperMethod(MybatisMapperProxy.java:65)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:60)
at com.sun.proxy.$Proxy111.updateBatch(Unknown Source)
at com.example.video_analy.modules.schedule.service.impl.ScheduleJobServiceImpl.updateBatch(ScheduleJobServiceImpl.java:108)
at com.example.video_analy.modules.schedule.service.impl.ScheduleJobServiceImpl.resume(ScheduleJobServiceImpl.java:138)
at com.example.video_analy.modules.schedule.service.impl.ScheduleJobServiceImpl$$FastClassBySpringCGLIB$$cde9f196.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
解决方法:将对于的接口Mapper.xml文件修改路径
bug
Bean with name 'configAreaServiceImpl' has been injected into other beans [configDeviceServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
原因:首先说一下什么是依赖循环,比如:我现在有一个ServiceA需要调用ServiceB的方法,那么ServiceA就依赖于ServiceB,那在ServiceB中再调用ServiceA的方法,就形成了循环依赖。Spring在初始化bean的时候就不知道先初始化哪个bean就会报错。
解决:互相依赖的两个bean上加上@Lazy注解也可以
报错:java.sql.SQLSyntaxErrorException: Table ‘examsys.Teacher’ doesn’t exist
问题原因:找不到Teacher这张表。因为在windows下的mysql表名不区分大小写,所以在windows下运行项目没问题。在linux中,mysql会区分大小写,所以sql语句表名用大写的就会找不到表
解决问题:
方法一(mysql8以下的版本):
#设置mysql表不区分大小写
lower_case_table_names=1
之后重启mysql服务即可。
systemctl restart mysqld
方法二(最土的办法):
代码量不多的话,就把所有的sql语句的表名全部换成小写的重新打包上传。
bug: 出现问题前端项目点击无反应,后端项目无问题
解决方法:
查看前端请求
检查iP地址,如果不对可以修改过来,如果是本地部署的就不需要改了,如果是服务器部署的需要将前端的index.js中的IP接口改成服务器公网的,检查前后端的端口号要一致。
查看端口命令
netstat -aon|findstr "8080"
杀掉端口
taskkill /pid 13620 /f
npm cache clean --force
重新安装一次即可
npm install
结果报错npm ERR! missing script: build,后来发现package.json中scripts参数为
“scripts”: {
“dev”: “vue-cli-service serve”,
"build:prod": “vue-cli-service build”,
“build:stage”: “vue-cli-service build --mode staging”,
“preview”: “node build/index.js --preview”,
“lint”: “eslint --ext .js,.vue src”,
“test:unit”: “jest --clearCache && vue-cli-service test:unit”,
“test:ci”: “npm run lint && npm run test:unit”,
“svgo”: “svgo -f src/icons/svg --config=src/icons/svgo.yml”
},
所以正确的命令应该为
npm run build:prod --report
解决方法来源
错误数据:
说明:全局脚手架和本地脚手架版本不一样。
解决方法:
执行 npm install npm@latest -g升级到最新版本(若升级到最新版本还是报错,则还需要再全局更新一下npm,更新后检查npm版本号不会变,内部应该有更新);
.删除本地node_modules 依赖包;
执行 npm cache clean --force 清理缓存;
npm i 安装依赖;
以上过程,尝试一次不行,可以多尝试几次就OK了
问题解决来源
描述:不修改idea中的maven不报错,但是修改成自己的maven,pom文件会爆红
解决方法: