ITeye博客

springboot项目错误

Janne · 2020-07-19 09:30 · 问题 · 编程语言 · 错误 · 数据库连接 · Markdown

swagger页面修改显示 war:参考https://www.jb51.cc/java/125142.html 问题一:idea创建spring boot项目时无法访问https://start.spring.io的解决方法 处理方法:建议使用阿里云的网址:https://start.aliyun.com/ idea编辑器安装及重点设置请参考:https://blog.csdn.net/zyplanke/article/details/105576304 问题二:java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName. 问题原因:1.5.x版本和2.0.x版本是有很大区别 解决办法, 方法一:修改配置application.properties 1.5.x版本的application.properties是这样命名的 spring.datasource.url 而2.0.x版以后是这样写的: spring.datasource.jdbc-url 方法二:在datasource后面添加hikari spring.datasource.hikari.driverClassName 方法三:在数据源配置时使用DataSourceProperties方法 参考:https://blog.csdn.net/MrLi_IT/article/details/80909078 问题三:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 原因:mybatis-spring-1.2.0中取消了自动注入SqlSessionFactory 和 SqlSessionTemplate 解决方案:因为我们dao层是继承于一个dao基类,所以只要在这个基类中注入任意一个属性即可。SqlSessionFactory在spring配置文件中已经配置。 public class CommonDao extends SqlSessionDaoSupport { @Resource public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory){ super.setSqlSessionFactory(sqlSessionFactory); } 参考:https://www.cnblogs.com/hawk0035/p/3337283.html?utm_source=tuicool 问题四:org.springframework.boot.devtools.restart.SilentExitExceptionHandler$SilentExitException 现状:在main()方法上,SpringApplication.run()一但放到try...catch块里就会导致devtools抛个异常报上面的错误,但实际上又不影响任何功能,devtools的热部署功能也仍然生效 解决方法:把main()里的try...catch去掉,或者把app.run(args)这句移出try...catch,或者catch到异常不要printStackTrace(),再运行就不会有错误日志了。 问题五: IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start componentatalina.LifecycleException: Failed to start component 错误原因:jar冲突或者版本不匹配 场景:引入cxf-spring-boot-starter-jaxws 3.2.4依赖后报错,后更改为其他低版本,依然再报错,后在网上看了把它换为不是springboot的即可,尝试 成功! 替换为: org.apache.cxf cxf-rt-transports-http 3.1.11 org.apache.cxf cxf-rt-frontend-jaxws 3.1.11 参考:https://blog.csdn.net/hawako/article/details/80556676?utm_medium=distribute.pc_relevant.none-task-blog-blogcommendfrommachinelearnpai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-blogcommendfrommachinelearnpai2-1.channel_param 问题6:连接数据库遇到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. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545) 解决办法: 修改位:jdbcUrl=jdbc:mysql://localhost:3306/secondskill?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。