仗剑走天涯

个人站

苟若恒,何必三更起五更眠,最无益,莫过一日暴十日寒


bugNote

目录

Docker

Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker

原因 :发现原来是dns服务器的错误,把服务器改成8.8.8.8或者114.114.114.114即可

解决办法:

# 1.修改dns配置
vim /etc/sysconfig/network-scripts/ifcfg-ens33
NETMASK=255.255.255.0
GATEWAY=192.168.41.254
dns1=114.114.114.114

# 2.vim /etc/resolv.conf 也加上这行
# Generated by NetworkManager
nameserver 114.114.114.114 

# 3.重启网络
systemctl restart network

maven

错误描述:10:14 Unable to import maven project: See logs for details

maven的本地配置不准确.

maven projects中显示灰色的解决办法

造成这个的原因可能是忽略了maven模块,可以尝试如下解决方法:在idea中maven的setting中找到ignored files,看右边的面板中是否将变灰的maven模块忽略了。我的模块变灰就是因为这个原因,Settings–>Maven–>Ignored Files 看看是不是有勾选的。

image-20210718091638005

然后 在maven中 reimport即可image-20210718091800295

数据库

MyBatis

Mybatis 报错Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]

千错万错,导包的错

导包时没注意是哪一个 param ,一定得是这个

import org.apache.ibatis.annotations.Param;

package ppppp.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import ppppp.entities.Order;

/**
* @author pppppp
* @date 2021/7/18 16:56
*/
@Mapper
public interface OrderDao {
   //1 新建订单
   void create(Order order);

   //2 修改订单状态,从零改为1
   @Update("update t_order set status = 1 where user_id=#{user_id} and status = #{status};")
   void update(@Param("user_id") Long userId, @Param("status") Integer status);
}

druid

引入 seata配置类后 一直报错 找不到配置文件 2021.08.11

java 类

@Configurationpublic class MySeataConfig {

    @Autowired
    DataSourceProperties dataSourceProperties;

    @Bean
    public DataSource dataSource(DataSourceProperties dataSourceProperties) {
        HikariDataSource dataSource = dataSourceProperties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
        if (StringUtils.hasText(dataSourceProperties.getName())) {
            dataSource.setPoolName(dataSourceProperties.getName());
        }
        return new DataSourceProxy(dataSource);
    }
}

配置文件

server:
  port: 11000
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.43.128:3306/gulimall_wms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
      username: root
      password: root

报错信息

Description:

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).

修改配置路径 为

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.43.128:3306/gulimall_wms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    username: root
    password: root

不报错,但是控制台一直出现错误信息

原因:

druid 暂时还不知道怎么去封装代理数据库

解决办法: 去掉druid前缀即可

idea

yml文件不出现小叶子

1.检查YAML中是否包含

  • *.yaml
  • *.yml

2.File -> settings -> Editor -> File Types 将txt中的 application.yml 去掉即可

解决办法参考

main函数无法显示run

不是 设置 src文件夹的原因,重新安装软件,/(ㄒoㄒ)/~~

打 jar包

https://cloud.tencent.com/developer/article/1764737

SpringBoot测试类启动错误

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

测试类要和著启动类有相同的文件目录

image-20210730160918661

linux

配置多个环境变量

#1. 编辑 /etc/profile
[root@centos-2 nginx]# vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk/jdk1.8.0_281
export NGINX_HOME=/usr/local/nginx
export PATH=$PATH:$JAVA_HOME/bin:$NGINX_HOME/sbin

#2. 让配置生效
[root@centos-2 nginx]# source /etc/profile  

#3. 测试
[root@centos-2 nginx]# nginx -v
nginx version: nginx/1.13.7

Windows

如何恢复自动更新?让应用商店能下载

2021-07-24

# 1.重置用户策略
rd /s /q "%windir%\System32\GroupPolicyUsers"
# 2.重置本地组策略,包括计算机配置和用户配置
rd /s /q "%windir%\System32\GroupPolicy"
# 3.强制更新命令让上述重置操作生效
gpupdate /force
# 4.重启电脑

你的设备中缺少重要的安全和质量修复

请您尝试删除临时更新文件,重新检查更新:

1)同时按下Windows键和R键,打开运行,输入services.msc    

2)找到WindowsUpdate服务项,右键选择禁用。

3)打开c:\windows\SoftwareDistribution,删除datastore和Download文件夹下的所有文件,然后将SoftwareDistribution文件夹重命名为SoftwareDistribution.old。

4)按照1和2的步骤开启WindowsUpdate服务。

VMware

无法打开内核设备:\\Global\\vmx86
  • 找到虚拟机文件 .vmx

  • 用记事本打开,手动找到vmci0.present=‘TRUE’,把true改为false。保存。即可。

无法安装 vmsi

卸载微软的更新即可

Kibana

启动报错:[resource_already_exists_exception]

# 解决方案:

# 1.查看这两个网址的响应(需要启动elasticsearch)

http://localhost:9200/_cat/indice
http://localhost:9200/_cat/aliases
其中一个应该会显示出.kibana_task_manager_1,这就是资源已存在的原因了

# 2.运行如下命令:
curl -X DELETE http://localhost:9200/.kibana*
这时再回到网址刷新后会发现.kibana_task_manager_1已消失,此时再启动Kibana,可正常使用

单元测试

没有run图标

// class 要是 public

npm

安装出错 npm ERR! request to https://registry.npmjs.org/express failed, reason: unable to verify the first certificate

npm config set strict-ssl false