Eclipse使用 junit测试, 报 “The builder launch configuration could not be found” 错误
解决方法如下:
- Package Explorer 视图下选中项目名
- 右键项目名,然后选择Properties 或者 在Eclipse 工具栏中选择 Project -> Properties
- 弹出的 Properties 对话框中,点击 Builders
- 将没有勾选,缺失的 builder 移除掉
- 点击 OK 按钮
DONE!
Eclipse使用 junit测试, 报 “The builder launch configuration could not be found” 错误
解决方法如下:
DONE!
ibatis 测试时出现错误提示: “could not find sql statement to include with refid xxx” , 出现这种错误一般是下面两种情况引起:
DONE!
nginx配置好后端网站配置文件后,提示 403 forbidden 的问题,这个问题其实是很常见的问题,一般都是由以下4个方面的原因引起的:
1.1查看nginx的启动用户,发现是nobody,而实际用root启动的
ps aux | grep "nginx: worker process" | awk'{print $1}'
1.2将nginx.config的user改为和启动用户一致,
vi conf/nginx.conf
server { listen 80; server_name localhost; index index.php index.html; root /data/www/; }
如果在/data/www/下面没有index.php,index.html的时候,直接文件,会报403 forbidden。
解决办法:修改web目录的读写权限,或者是把nginx的启动用户改成目录的所属用户,重启Nginx即可解决
chmod -R 777 /data chmod -R 777 /data/web/
4.1、查看当前selinux的状态。
/usr/sbin/sestatus
4.2、将SELINUX=enforcing 修改为 SELINUX=disabled 状态。
vi /etc/selinux/config #SELINUX=enforcing SELINUX=disabled
4.3、重启生效。reboot。
reboot
mybatis下limit如果想做分页,对limit做参数计算时:
错误的写法:
<select id=”queryMyApplicationRecord” parameterType=”MyApplicationRequest” resultMap=”myApplicationMap”>
SELECT
a.*,
FROM
tb_user a
WHERE 1=1
<if test=”ids != null and ids.size()!=0″>
AND a.id IN
<foreach collection=”ids” item=”id” index=”index”
open=”(” close=”)” separator=”,”>
#{id}
</foreach>
</if>
<if test=”statusList != null and statusList.size()!=0″>
AND a.status IN
<foreach collection=”statusList” item=”status” index=”index”
open=”(” close=”)” separator=”,”>
#{status}
</foreach>
</if>
ORDER BY a.create_time desc
LIMIT (#{pageNo}-1)*#{pageSize},#{pageSize}; // 错误
</select>
在MyBatis中LIMIT之后的语句不允许的变量不允许进行算数运算,会报错。
正确的写法一:
<select id=”queryMyApplicationRecord” parameterType=”MyApplicationRequest” resultMap=”myApplicationMap”>
SELECT
a.*,
FROM
tb_user a
WHERE 1=1
<if test=”ids != null and ids.size()!=0″>
AND a.id IN
<foreach collection=”ids” item=”id” index=”index”
open=”(” close=”)” separator=”,”>
#{id}
</foreach>
</if>
<if test=”statusList != null and statusList.size()!=0″>
AND a.status IN
<foreach collection=”statusList” item=”status” index=”index”
open=”(” close=”)” separator=”,”>
#{status}
</foreach>
</if>
ORDER BY a.create_time desc
LIMIT ${(pageNo-1)*pageSize},${pageSize}; (正确)
</select>
正确的写法二:(推荐)
<select id=”queryMyApplicationRecord” parameterType=”MyApplicationRequest” resultMap=”myApplicationMap”>
SELECT
a.*,
FROM
tb_user a
WHERE 1=1
<if test=”ids != null and ids.size()!=0″>
AND a.id IN
<foreach collection=”ids” item=”id” index=”index”
open=”(” close=”)” separator=”,”>
#{id}
</foreach>
</if>
<if test=”statusList != null and statusList.size()!=0″>
AND a.status IN
<foreach collection=”statusList” item=”status” index=”index”
open=”(” close=”)” separator=”,”>
#{status}
</foreach>
</if>
ORDER BY a.create_time desc
LIMIT #{offSet},#{limit}; (推荐,代码层可控)
</select>
分析:方法二的写法,需要再请求参数中额外设置两个get函数,如下:
@Data
public class QueryParameterVO {
private List<String> ids;
private List<Integer> statusList;
// 前端传入的页码
private int pageNo; // 从1开始
// 每页的条数
private int pageSize;
// 数据库的偏移
private int offSet;
// 数据库的大小限制
private int limit;
// 这里重写offSet和limit的get方法
public int getOffSet() {
return (pageNo-1)*pageSize;
}
public int getLimit() {
return pageSize;
}
}
今天升级macOS 到 macOS mojave,升级完后终端里使用git的时候,弹出一行错误:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
解决方法,重装xcode command line:
xcode-select --install
如果没有解决问题,执行以下命令
sudo xcode-select -switch /
DONE!!