# 目录


# 1.项目编译报错

问题描述

git clone DBlog后,ide打开提示编译报错,发现实体类中缺少setter和getter方法,这是因为DBlog中使用了lombok插件所致,只需要安装对应的lombok插件即可。

解决方案:

eclipse安装lombok (opens new window)

idea安装lombok: file->settings->plugins->Browse Repositories->输入lombok,点击搜索->选中lombok点击install->安装完成后重启idea

进阶版问题: idea中安装完lombok并重启idea之后,启动项目仍然报错: 输入图片说明 解决办法 输入图片说明 默认是eclipse 选择javac就可以了

该解决方案贡献者:Cary Lau

# 2. SQL异常

问题描述

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #20 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'c.commentCount' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
...
...
1
2
3
4
5
6
7

解决方案

注意,异常提示中的 sql_mode=only_full_group_by ,这是MySQL 5.7.9版本sql_mode=only_full_group_by问题,请参考以下文章:

https://www.cnblogs.com/jim2016/p/6322703.html https://www.cnblogs.com/grimm/p/5751911.html

# 3. Redis异常

问题描述

org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:204)
	at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:348)
	at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:129)
	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:92)
	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:79)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:194)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
	at org.springframework.data.redis.core.RedisTemplate.hasKey(RedisTemplate.java:658)
...
...
1
2
3
4
5
6
7
8
9
10
11

解决方案

OneBlog博客依赖于Redis,请参考【OneBlog-快速开始-修改相关配置文件 (opens new window)】中的第二步关于redis配置文件的修改说明

特别提醒:如果redis未设置密码,可把配置文件中redis的password配置直接注释掉!!

# 4. 百度分享无法使用

将上图所示,js部分的代码,copy到article.ftl页面中,获取代码 (opens new window)

# 5. 文章推送功能不可用

如果看到上面提示,则表示项目里为设置站长平台的Cookie,(Cookie配置类:BaiduPushUtil.java (opens new window)

获取百度站长平台的Cookie,点我 (opens new window)。登录成功后,将下图所示的cookie按照key=value;key=value;的格式全部copy到BaiduPushUtil.java (opens new window)

或者可以直接copy这个

# 6. Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

问题描述

启动报错:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-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).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

解决方案

1.资源拷贝的问题,检查一下打包后的target/classes文件夹是否存在配置文件

解决办法:

如果存在application.yml存在,多半是application.yml编码格式的问题,文件编码改成utf-8

# 7. Process finished with exit code 1

问题描述

====================================================================================================================================

                                 欢迎使用 OneBlog 博客系统(原DBlog) - Powered By https://www.zhyd.me
                                    官方开源地址(Gitee):https://gitee.com/yadong.zhang/DBlog
                                    官方开源地址(Github):https://github.com/zhangyd-c/OneBlog
                                                      唯一官方QQ群:190886500

                                           _____                 ______   _
                                          |  _  |                | ___ \ | |
                                          | | | |  _ __     ___  | |_/ / | |   ___     __ _
                                          | | | | | '_ \   / _ \ | ___ \ | |  / _ \   / _` |
                                          \ \_/ / | | | | |  __/ | |_/ / | | | (_) | | (_| |
                                           \___/  |_| |_|  \___| \____/  |_|  \___/   \__, |
                                                                                       __/ |
                                                                                      |___/

                                              当前SpringBoot版本 :: 2.0.8.RELEASE
====================================================================================================================================

Process finished with exit code 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

解决方案

# 1. install
mvn clean install -Dmaven.test.skip=true
# 2. 重启
1
2
3

# 8.打war包

请参考:

  • https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging
  • https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file

本人不建议打war包(旧项目迁移到sb的除外),因噎废食不可取

# 9. 登录弹窗中提示:“稍等一下,博主正在快马加鞭的配置~~”

OneBlog的web模块没有单独开发登录注册功能,而是集成JustAuthPlus(JAP) (opens new window)使用的第三方登录。

社会化登录的配置,请参考 第三方配置参考 - 5. 社会化登录(第三方登录)

# 其他问题

如在使用过程中遇到其他问题,可以提交Issue (opens new window),或者进QQ群讨论:190886500 (opens new window)