目录
springcloud
1、snakeyaml
2、optionalArgs
3、 hostname
4、StatusRuntimeException
5、Param 'serviceName' is illegal
6、could not be found
集合
list与数组互转
lamda方式排序
Docker
1、删除为none的镜像
2、already in use by container
windows与虚拟机(centos)
1、Device/Credential Guard
2.没有东西提供 module(perl:5.26)
3.linux centos8安装docker一系列问题解决
4.未知的名称或服务
github
1、github访问不了(2023年8月)
java.lang.NoSuchMethodError: org.yaml.snakeyaml.representer.Representer: method
版本问题
org.yaml
snakeyaml
1.26
参考地址:Getting java.lang.NoSuchMethodError: org.yaml.snakeyaml.Yaml.
Field optionalArgs in org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$Refresh
引入依赖(版本根据需要指定,version部分省略)
org.springframework.boot
spring-boot-starter-web
java.lang.IllegalStateException: Request URI does not contain a valid hostname
微服务名称不合法(不能识别下划线的服务名称)或者不是注册中心所使用的名称
User user = restTemplate.getForObject("http://EUREKA-USER/user/1", User.class);
这个问题主要是nacos版本与spring-cloudalibaba版本对应问题
com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE
com.alibaba.cloud
spring-cloud-alibaba-dependencies
2021.0.1.0
pom
import
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
java.lang.IllegalArgumentException: Param 'serviceName' is illegal, serviceName is blank
参考:Param ‘serviceName‘ is illegal, serviceName is blank --------报错_java.lang.illegalargumentexception: param 'service_皆是梦的博客-CSDN博客
org.springframework.cloud
spring-cloud-starter-bootstrap
A component required a bean of type 'com.openapi.xxx' that could not be found
一般是引入的bean未被spring容器管理到,则需要将对应包的扫描路径进行配置,一般配置对应的注解中添加basePackages
其中很容易忽视的基础:工程规范问题
比如mybatis
// mybatis
@MapperScan(basePackages={"com.admin.mapper"})
// feign
@EnableFeignClients(clients = {xxx.class}) //方式1
//@EnableFeignClients(basePackages = {"com.openapi.xxx"}) //方式2
1.List转数组
方式1:String[] array = list.toArray(new String[list.size()]);
方式2:String[] array = list.stream().toArray(String[]::new);
2.数组转List
方式1:Collections.addAll(list, array);
方式2:List list1 = Arrays.asList(array);
方式3:List collect = Arrays.stream(array).collect(Collectors.toList());
// 安装某个字段分组 常用JSON结构:{"key":[],"key2":[]}
Map> collect = checkList.stream().collect(Collectors.groupingBy(f -> f.getWord_name()));
//排序
List d_post_code = collect.get("d_post_code").stream().sorted(Comparator.comparing(WordCheck::getWord_order)).collect(Collectors.toList());
【Error response from daemon: conflict: unable to delete 5a695b65d145 (must be forced) - image is being used by stopped container cd07b936e0fb】
[root@localhost /]# docker images
[root@localhost /]# docker rmi -f image_id
[root@localhost /]# docker rmi -f 9a3244537312
Deleted: sha256:9a3244537312288e435c00cc0d4d4cb8ebcd9ff630af4e2ea6454959e831364c
Deleted: sha256:79395207ed09b2835585c063a77c133d235c59d55c2ca0c85e719cdb30f35ec1
The container name "/rabbitmq" is already in use by container
删除占用的即可
[root@localhost ~]# docker ps -a
[root@localhost ~]# docker rm 5c1fb19d3999
附rabbitmq启动
[root@localhost ~]# docker run \
-v $(pwd)/data/rabbitmq:/var/lib/rabbitmq \
-p 5672:5672 -p 15672:15672 --name rabbitmq -d \
-e RABBITMQ_DEFAULT_USER=root \
-e RABBITMQ_DEFAULT_PASS=hadoop \
-e RABBITMQ_DEFAULT_VHOST=demo \
rabbitmq:3.8-management
正常安装步骤
参考docker官网文档【Install Docker Engine on CentOS | Docker Documentation】
公共镜像参考地址【Docker】
步骤1:sudo yum install -y yum-utils
步骤2:sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
步骤3:sudo yum install --allowerasing docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
有问题参考下面文章【3.linux centos8安装docker一系列问题解决】
主要解决:1.网络问题 2.yum安装包 3.安装依赖问题
=====解决VM 与 Device/Credential Guard 不兼容====
Windows Powershell (管理员)(Windows键+X)
bcdedit /set hypervisorlaunchtype off
=====解决VM 与 Device/Credential Guard 不兼容====
安装一下
[root@localhost ~]# yum module enable perl:5.26
[root@localhost ~]# sudo yum remove docker \
> docker-client \
> docker-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine
模块依赖问题:
问题 1: 冲突的请求
- 没有东西提供 module(perl:5.26)(模块 perl-DBD-SQLite:1.58:8030020200716174729:3a70019f.x86_64 需要它)
问题 2: 冲突的请求
- 没有东西提供 module(perl:5.26)(模块 perl-DBI:1.641:8030020200716150652:1e4bbb35.x86_64 需要它)
如:
问题 1: 安装的软件包的问题 podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64
- 软件包 podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64 需要 runc >= 1.0.0-57,但没有提供者可以被安装
- 软件包 containerd.io-1.6.22-3.1.el8.x86_64 与 runc(由 runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64 提供)冲突
- 软件包 containerd.io-1.6.22-3.1.el8.x86_64 取代了 runc(由 runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64 提供)
如:
未提供依赖perl-DBD-SQLite、perl-DBI
如:
未知的名称或服务【域名解析问题】
下载元数据失败【AppStream 缓存失败,忽略这个 repo 等】
1.1 检查网络
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (157.148.69.74) 56(84) bytes of data.
64 bytes from 157.148.69.74 (157.148.69.74): icmp_seq=1 ttl=128 time=11.4 ms
64 bytes from 157.148.69.74 (157.148.69.74): icmp_seq=2 ttl=128 time=11.0 ms
1.2 域名解析 打开并添加域名解析地址 i进行编辑 --> esc退出--> shft+: 进行底行模式 -->wq -->回车保存
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
[root@localhost ~]# service network restart关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
禁用防火墙
[root@localhost ~]# systemctl disable firewalld.service
参考文章地址:https://wenku.csdn.net/answer/7219741ce81111edbcb5fa163eeb3507
[root@localhost ~]# vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
[root@localhost ~]# sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
[root@localhost ~]# dnf update dnf rpm -y
[root@localhost ~]# yum module enable perl:5.26
[root@localhost ~]# yum install -y podman修改三个文件
cd /etc/yum.repos.d-rw-r--r--. 1 root root 719 9月 14 2021 CentOS-Linux-AppStream.repo
-rw-r--r--. 1 root root 704 9月 14 2021 CentOS-Linux-BaseOS.repo
-rw-r--r--. 1 root root 704 9月 14 2021 CentOS-Linux-Extras.repo
CentOS-Linux-AppStream.repo
#========CentOS-Linux-AppStream.repo内容========
#[AppStream]
#name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
##baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
#========CentOS-Linux-AppStream.repo========
CentOS-Linux-BaseOS.repo
#========2021 CentOS-Linux-BaseOS.repo========
#[BaseOS]
#name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
##baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial[BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
#========2021 CentOS-Linux-BaseOS.repo========
CentOS-Linux-Extras.repo
#========CentOS-Linux-Extras.repo========#[extras]
#name=CentOS Linux $releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
##baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
#========CentOS-Linux-Extras.repo========
刷新
[root@localhost ~]# dnf clean all
[root@localhost ~]# dnf makecache重启服务器
[root@localhost ~]# reboot
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
[root@localhost ~]# service network restart
!!!纯属网络限制问题,有时开放了有时不行,可以的话找个软件,付费解决一下(纯属开发学习使用推荐,具体软件名称可自行搜索)