本篇文章给大家谈谈cURLerror6:Couldnotresolve:api.weixin.qq.com(CouldnotcontactDNSservers),同时本文还将给你拓展114DNSPub
本篇文章给大家谈谈cURL error 6: Could not resolve: api.weixin.qq.com (Could not contact DNS servers),同时本文还将给你拓展114DNS Public DNS+ 阿里 DNS 百度 DNS 360 DNS 派 Google DNS、14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"、6.mybatis 异常:SQL Mapper Configuration,Error parsing Mapper XML,Could not resolve type alias、Centos 中 tomcat 关闭报错,Could not contact localhost:8005. Tomcat may not be running等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:- cURL error 6: Could not resolve: api.weixin.qq.com (Could not contact DNS servers)
- 114DNS Public DNS+ 阿里 DNS 百度 DNS 360 DNS 派 Google DNS
- 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
- 6.mybatis 异常:SQL Mapper Configuration,Error parsing Mapper XML,Could not resolve type alias
- Centos 中 tomcat 关闭报错,Could not contact localhost:8005. Tomcat may not be running
cURL error 6: Could not resolve: api.weixin.qq.com (Could not contact DNS servers)
“api.weixin.qq.com” 定位是否微信服务器问题,一般不太可能。
1. 首先呢,我们根据出现的问题对问题的故障进行排查,由于后端使用 curl 进行连接的,所以我们首先要保证我们的 curl 连接是正常的,需要测试一下 curl 是否能够正常解析 dns,使用如下命令进行测试工作:
curl api.weixin.qq.com
最终测试结果为 ping 不通!继而我们开始执行对应新的解决方案。
2.ping 不通一般情况下属于 DNS 配置相关的问题,所以我们开始进行编辑修改 DNS 配置文件:
vi /etc/resolv.conf
在源文件的内容基础之下,添加如下两行代码:
nameserver 114.114.114.114
nameserver 8.8.8.8
114DNS Public DNS+ 阿里 DNS 百度 DNS 360 DNS 派 Google DNS
114DNS、腾讯 dnspod DNS、阿里 DNS、百度 DNS、360DNS、Google DNS 公 共 DNS 评测体验报告从 ping 及 dig 返回时间对比测试,国内 DNS 普遍很快,而阿里 DNS 最快,次之腾讯 dnspod DNS,然后 114DNS,百度及 360DNS 派中规中矩,而 Google DNS 还是很慢(由于众所周知的原因,你懂的)我们还是拥抱国产 DNS 吧,推荐腾讯 DNSPOD DNS 119.29.29.29 阿里 DNS 223.6.6.6 和 223.5.5.5
来看看各家 DNS 的介绍:
114 DNS
高速 电信联通移动全国通用 DNS,能引导您到最快的网站,手机和计算机都可用
稳定 DNS 解析成功率超高,与 ISP 的 DNS 相比,能访问更多的国内外网站
可靠 3000 万个家庭和企业 DNS 的后端技术支持,多次为电信运营商提供 DNS 灾备
纯净 无劫持 无需再忍受被强扭去看广告或粗俗网站之痛苦
服务 ip 为:114.114.114.114 和 114.114.115.115
拦截 钓鱼病毒木马网站 增强网银、证券、购物、游戏、隐私信息安全
服务 ip 为:114.114.114.119 和 114.114.115.119
学校或家长可选拦截 色情网站 保护少年儿童免受网络色情内容的毒害
服务 ip 为:114.114.114.110 和 114.114.115.110
Public DNS+
服务 IP 为 119.29.29.29 号称安全零劫持。
Public DNS + 是(腾讯旗下)DNSPod 推出的公共域名解析服务,类似于其他公共 DNS(如 Google 的 8.8.8.8 和 114dns 的 114.114.114.114),可以为全网用户提供域名的公共递归解析服务(区别于 DNSPod 原有的域名授权解析服务)。
Public DNS + 凭借 DNSPod 多年的域名解析服务经验开发,并依托于腾讯强大的资源优势,旨在为用户提供更加快速、准确、稳定的递归解析服务,且我们不会对任何域名进行恶意劫持。
阿里 DNS
服务 ip 为:223.5.5.5 和 223.6.6.6 阿里巴巴集团众多优秀工程师开发维护的公共 DNS—AliDNS
作为国内最大的互联网基础服务提供商,阿里巴巴在继承多年优秀技术的基础上,通过提供性能优异的公共 DNS 服务,为广大互联网用户提供最可靠的递归解决方案.
阿里公共 DNS 是阿里巴巴集团推出的 DNS 递归解析系统,目标是成为国内互联网基础设施的组成部分,面向互联网用户提供 “快速”、“稳定”、“智能” 的免费 DNS 递归解析服务。
百度 DNS
服务 IP 为:180.76.76.76 百度公共 DNS 是百度系统部推出的递归 DNS 解析服务。
云防护,从此上网无患
病毒、木马、钓鱼网站一网拦截,百度云防护实时守护用户的访问安全。
无劫持,从此上网无阻
无恶意跳转,无强制广告,百度公共 DNS 让用户访问更加畅通无阻。
更精准,从此上网无忧
遍布全国的 CDN 网络、智能解析、edns-client-subnet… 所有的努力只为让定位更精准,让用户的每一次访问都更高效。
360 DNS 派
服务 ip 为:电信:首选:101.226.4.6 联通:首选:123.125.81.6 移动:首选:101.226.4.6 铁通:首选:101.226.4.6
使用 DNS 派 的公共 DNS 解析服务后,让网上冲浪更加稳定、快速、安全;为家庭拦截钓鱼网站,过滤非法网站,建立一个绿色健康的网上环境;为域名拼写自动纠错,让上网更方便。
Google DNS
服务 ip 为:8.8.8.8 和 8.8.4.4
而 Google 表示推出免费 DNS 服务的主要目的就是为了改进网络浏览速度、改善网络用户的浏览体验,为此 Google 并不使用 BIND 等广为使用的 DNS 程序,而是以自行开发的软件对 DNS 服务器技术进行了改进,在两层计算机簇上,缓存 DNS 服务器平衡负载以提升性能,同时保证了 DNS 服务的安全性和准确 性。
Open DNS
服务 ip 为:208.67.222.222 和 208.67.220.220
知道这个比 Google 还早,也是非常知名的,但延迟有点高,在 180ms 左右,偶尔掉包,除了延迟大点,没有什么不能接受的。
[root@localhost ~]# ping 114.114.114.114 -c 4;ping 119.29.29.29 -c 4;ping 223.6.6.6 -c 4;ping 180.76.76.76 -c 4;ping 101.226.4.6 -c 4;ping 8.8.8.8 -c 4
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
64 bytes from 114.114.114.114: icmp_seq=1 ttl=77 time=24.9 ms
64 bytes from 114.114.114.114: icmp_seq=2 ttl=95 time=26.5 ms
64 bytes from 114.114.114.114: icmp_seq=3 ttl=65 time=26.0 ms
64 bytes from 114.114.114.114: icmp_seq=4 ttl=76 time=26.4 ms
— 114.114.114.114 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3031ms
rtt min/avg/max/mdev = 24.919/25.990/26.536/0.671 ms
PING 119.29.29.29 (119.29.29.29) 56(84) bytes of data.
64 bytes from 119.29.29.29: icmp_seq=1 ttl=53 time=10.2 ms
64 bytes from 119.29.29.29: icmp_seq=2 ttl=53 time=15.3 ms
64 bytes from 119.29.29.29: icmp_seq=3 ttl=53 time=10.0 ms
64 bytes from 119.29.29.29: icmp_seq=4 ttl=53 time=9.68 ms
— 119.29.29.29 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3014ms
rtt min/avg/max/mdev = 9.684/11.345/15.391/2.345 ms
PING 223.6.6.6 (223.6.6.6) 56(84) bytes of data.
64 bytes from 223.6.6.6: icmp_seq=1 ttl=53 time=7.56 ms
64 bytes from 223.6.6.6: icmp_seq=2 ttl=53 time=8.45 ms
64 bytes from 223.6.6.6: icmp_seq=3 ttl=53 time=7.08 ms
64 bytes from 223.6.6.6: icmp_seq=4 ttl=53 time=6.69 ms
— 223.6.6.6 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3011ms
rtt min/avg/max/mdev = 6.698/7.450/8.453/0.661 ms
PING 180.76.76.76 (180.76.76.76) 56(84) bytes of data.
64 bytes from 180.76.76.76: icmp_seq=1 ttl=54 time=36.7 ms
64 bytes from 180.76.76.76: icmp_seq=2 ttl=54 time=37.3 ms
64 bytes from 180.76.76.76: icmp_seq=3 ttl=54 time=36.5 ms
64 bytes from 180.76.76.76: icmp_seq=4 ttl=54 time=36.1 ms
— 180.76.76.76 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3041ms
rtt min/avg/max/mdev = 36.136/36.675/37.327/0.432 ms
PING 101.226.4.6 (101.226.4.6) 56(84) bytes of data.
64 bytes from 101.226.4.6: icmp_seq=1 ttl=55 time=30.5 ms
64 bytes from 101.226.4.6: icmp_seq=2 ttl=55 time=30.7 ms
64 bytes from 101.226.4.6: icmp_seq=3 ttl=55 time=28.4 ms
64 bytes from 101.226.4.6: icmp_seq=4 ttl=55 time=30.6 ms
— 101.226.4.6 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3035ms
rtt min/avg/max/mdev = 28.478/30.091/30.722/0.934 ms
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=2 ttl=45 time=39.6 ms
— 8.8.8.8 ping statistics —
4 packets transmitted, 1 received, 75% packet loss, time 4000ms
rtt min/avg/max/mdev = 39.617/39.617/39.617/0.000 ms
[root@localhost ~]# traceroute -n 114.114.114.114;traceroute -n 119.29.29.29;traceroute -n 223.6.6.6;traceroute -n 180.76.76.76;traceroute -n 101.226.4.6;traceroute -n 8.8.8.8
traceroute to 114.114.114.114 (114.114.114.114), 30 hops max, 60 byte packets
1 192.168.1.100 0.470 ms 0.670 ms 0.886 ms
2 100.64.0.1 6.717 ms 6.723 ms 10.996 ms
3 183.56.68.41 6.734 ms 6.794 ms 6.844 ms
4 183.56.64.161 7.278 ms 7.200 ms 7.313 ms
5 183.56.65.38 10.736 ms 10.794 ms 10.733 ms
6 202.97.64.77 33.088 ms 32.746 ms 32.487 ms
7 218.2.134.2 32.125 ms 26.167 ms 26.070 ms
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
traceroute to 119.29.29.29 (119.29.29.29), 30 hops max, 60 byte packets
1 192.168.1.100 0.448 ms 0.654 ms 0.871 ms
2 100.64.0.1 131.462 ms 131.469 ms 131.562 ms
3 183.56.68.97 6.767 ms 6.779 ms 6.778 ms
4 183.56.64.113 6.848 ms 6.902 ms 6.999 ms
5 183.56.65.14 10.389 ms 10.449 ms 10.617 ms
6 61.140.0.37 10.306 ms 10.130 ms 11.986 ms
7 61.140.1.10 16.669 ms 10.706 ms 10.718 ms
8 183.61.145.194 9.224 ms 10.416 ms 10.001 ms
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
traceroute to 223.6.6.6 (223.6.6.6), 30 hops max, 60 byte packets
1 192.168.1.100 0.462 ms 0.669 ms 0.890 ms
2 14.127.64.1 13.381 ms 13.834 ms 14.015 ms
3 113.106.43.229 7.094 ms 7.107 ms 7.198 ms
4 119.136.12.158 7.109 ms 7.232 ms 7.284 ms
5 183.56.66.2 10.394 ms 183.56.65.62 13.996 ms 183.56.65.74 8.326 ms
6 119.147.221.10 7.730 ms 119.147.223.106 9.083 ms 119.147.221.130 11.309 ms
7 119.147.220.238 12.315 ms 7.492 ms 7.509 ms
8 * * 14.215.137.50 9.989 ms
9 * 42.120.242.234 10.362 ms 10.063 ms
10 42.120.242.214 14.005 ms * 14.055 ms
11 42.120.253.10 6.657 ms * 42.120.253.2 8.375 ms
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
traceroute to 180.76.76.76 (180.76.76.76), 30 hops max, 60 byte packets
1 192.168.1.100 0.378 ms 0.581 ms 0.797 ms
2 14.127.64.1 7.265 ms 7.344 ms 7.409 ms
3 113.106.43.229 7.197 ms 7.313 ms 7.432 ms
4 59.40.49.110 7.507 ms 7.563 ms 7.590 ms
5 * * *
6 202.97.65.101 42.138 ms 42.004 ms *
7 * * *
8 220.181.17.118 38.775 ms * 39.623 ms
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
traceroute to 101.226.4.6 (101.226.4.6), 30 hops max, 60 byte packets
1 192.168.1.100 0.495 ms 0.723 ms 0.882 ms
2 100.64.0.1 6.797 ms 6.844 ms 6.984 ms
3 183.56.68.41 6.885 ms 7.006 ms 7.060 ms
4 183.56.64.153 7.126 ms 7.187 ms 7.235 ms
5 183.56.65.2 11.666 ms 11.620 ms 11.698 ms
6 61.152.86.209 34.800 ms 38.168 ms 34.288 ms
7 * * *
8 124.74.233.134 31.913 ms 31.789 ms 33.247 ms
9 101.226.0.30 34.916 ms 33.804 ms 33.766 ms
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 192.168.1.100 0.433 ms 0.649 ms 0.859 ms
2 14.127.64.1 6.670 ms 6.890 ms 8.232 ms
3 113.106.43.233 6.648 ms 8.238 ms 8.758 ms
4 119.136.12.142 7.658 ms 8.177 ms 8.247 ms
5 183.56.65.62 14.300 ms 183.56.65.54 10.677 ms 183.56.65.62 14.295 ms
6 202.97.35.210 15.390 ms 15.077 ms 15.025 ms
7 202.97.60.70 11.663 ms 202.97.91.178 10.466 ms 202.97.60.70 10.198 ms
8 202.97.61.22 11.875 ms 14.665 ms 14.108 ms
9 202.97.62.214 11.413 ms 11.453 ms 12.505 ms
10 209.85.241.58 15.582 ms 13.576 ms 209.85.241.56 23.106 ms
11 216.239.40.13 11.598 ms 216.239.40.11 13.685 ms 12.834 ms
12 209.85.253.89 38.926 ms 38.903 ms 37.668 ms
13 64.233.175.205 44.340 ms 209.85.250.103 39.732 ms 39.431 ms
14 * * *
15 8.8.8.8 40.948 ms 41.787 ms 41.446 ms
后续有很多开发填坑的文章发布,如果对你有帮助,请支持和加关注一下
http://e22a.com/h.05ApkG?cv=AAKHZXVo&sm=339944
https://shop119727980.taobao.com/?spm=0.0.0.0
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
One of the configured repositories failed (未知),
and yum doesn''t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won''t use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
解决方式:
vim /etc/resolv.conf
插入:
nameserver 8.8.8.8
nameserver 8.8.4.4
6.mybatis 异常:SQL Mapper Configuration,Error parsing Mapper XML,Could not resolve type alias
在 xxxMapper 中
<select id="getClazz" parameterType="int" resultType="getClazzMap">
SELECT * FROM class c,teacher t WHERE c.tid = t.tid AND c.cid=#{id}
</select>
<resultMap type="Clazz" id="getClazzMap">
<id property="id" column="cid"/>
<result property="name" column="cname"/>
<!-- 关联班级对应的teacher -->
<association property="teacher" javaType="Teacher">
<id property="id" column="tid"/>
<result property="name" column="tname"/>
</association>
</resultMap>
查各种资料发现,用到 resultType,必须在 mybatis 的配置文件中进行别名申明该 resultType 属于哪个实体类:
<!-- 配置xxxMapper.xml中的实体类的别名 -->
<typeAliases>
<!-- 单个实体类配置别名 -->
<typeAlias type="com.mlxs.mybatis.test1.User" alias="User"/>
<typeAlias type="com.mlxs.mybatis.test1.Clazz" alias="getClassMap"/>
<!-- 整个包配置,别名默认为类名 推荐 -->
<package name="com.mlxs.mybatis.bean"/>
</typeAliases>
但是,其实我这上面用错了,我真正要用的是 resultMap,不是 resultType
<select id="getClazz" parameterType="int" resultMap="getClazzMap">
SELECT * FROM class c,teacher t WHERE c.tid = t.tid AND c.cid=#{id}
</select>
<resultMap type="Clazz" id="getClazzMap">
<id property="id" column="cid"/>
<result property="name" column="cname"/>
<!-- 关联班级对应的teacher -->
<association property="teacher" javaType="Teacher">
<id property="id" column="tid"/>
<result property="name" column="tname"/>
</association>
</resultMap>
这个在写的时候要非常注意... ...
Centos 中 tomcat 关闭报错,Could not contact localhost:8005. Tomcat may not be running
在 Centos7 服务器中关闭 tomcat 一直出现 Could not contact localhost:8005. Tomcat may not be running。
经过网上查资料,需要做如下修改:
在 jdk 安装路径 jdk1.8.0_40/jre/lib/security 中修改 java.security 文件:
将 "securerandom.source=file:/dev/random"
修改为"securerandom.source=file:/dev/./urandom"
修改完后,重新启动 tomcat 即可。
今天关于cURL error 6: Could not resolve: api.weixin.qq.com (Could not contact DNS servers)的介绍到此结束,谢谢您的阅读,有关114DNS Public DNS+ 阿里 DNS 百度 DNS 360 DNS 派 Google DNS、14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"、6.mybatis 异常:SQL Mapper Configuration,Error parsing Mapper XML,Could not resolve type alias、Centos 中 tomcat 关闭报错,Could not contact localhost:8005. Tomcat may not be running等更多相关知识的信息可以在本站进行查询。
本文标签: