You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "will-zdu (via GitHub)" <gi...@apache.org> on 2023/05/10 05:53:08 UTC
[GitHub] [dubbo] will-zdu opened a new issue, #12277: jdk18下启动dubbo,会出现zookeeper地址解析失败的错误
will-zdu opened a new issue, #12277:
URL: https://github.com/apache/dubbo/issues/12277
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: 3.0.5
* Operating System version: 5.4.0-144-generic
* Java version: jdk17
### Steps to reproduce this issue
1. 使用jdk17 启动dubbo,设置zookeeper地址为127.0.0.1:2181
dubbo:
registry:
address: zookeeper://127.0.0.1:2181
consumer:
timeout: 3000
2. 启动之后就会看到报错
Pls. provide [GitHub address] to reproduce this issue.
任何dubbo简单应用均可复现,主要原因是jdk18导致
### Expected Behavior
正常成功启动
<!-- What do you expect from the above steps?-->
### Actual Behavior
启动报错
<!-- What actually happens? -->
```
If there is an exception, please attach the exception trace:
java.nio.channels.UnresolvedAddressException: null
at java.base/sun.nio.ch.Net.checkAddress(Net.java:149) ~[na:na]
at java.base/sun.nio.ch.Net.checkAddress(Net.java:157) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:816) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:839) ~[na:na]
at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277) ~[zookeeper-3.4.13.jar:3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03]
at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287) ~[zookeeper-3.4.13.jar:3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03]
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021) ~[zookeeper-3.4.13.jar:3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064) ~[zookeeper-3.4.13.jar:3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03]
```
根因我看是因为jdk18中的
java.net.InetSocketAddress.InetSocketAddressHolder#toString
```java
@Override
public String toString() {
String formatted;
if (isUnresolved()) {
formatted = hostname + "/<unresolved>";
} else {
formatted = addr.toString();
if (addr instanceof Inet6Address) {
int i = formatted.lastIndexOf("/");
formatted = formatted.substring(0, i + 1)
+ "[" + formatted.substring(i + 1) + "]";
}
}
return formatted + ":" + port;
}
```
org.apache.zookeeper.client.ConnectStringParser#ConnectStringParser
```java
public ConnectStringParser(String connectString) {
// parse out chroot, if any
int off = connectString.indexOf('/');
if (off >= 0) {
String chrootPath = connectString.substring(off);
// ignore "/" chroot spec, same as null
if (chrootPath.length() == 1) {
this.chrootPath = null;
} else {
PathUtils.validatePath(chrootPath);
this.chrootPath = chrootPath;
}
connectString = connectString.substring(0, off);
} else {
this.chrootPath = null;
}
String hostsList[] = connectString.split(",");
for (String host : hostsList) {
int port = DEFAULT_PORT;
int pidx = host.lastIndexOf(':');
if (pidx >= 0) {
// otherwise : is at the end of the string, ignore
if (pidx < host.length() - 1) {
port = Integer.parseInt(host.substring(pidx + 1));
}
host = host.substring(0, pidx);
}
serverAddresses.add(InetSocketAddress.createUnresolved(host, port));
}
}
```
serverAddresses.add(InetSocketAddress.createUnresolved(host, port));导致出现了hostAddress非法的情况
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #12277: jdk18下启动dubbo,会出现zookeeper地址解析失败的错误
Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12277:
URL: https://github.com/apache/dubbo/issues/12277#issuecomment-1543766227
curator 版本多少,需要使用 5 及以上版本
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] jdk18下启动dubbo,会出现zookeeper地址解析失败的错误 [dubbo]
Posted by "CrazyHZM (via GitHub)" <gi...@apache.org>.
CrazyHZM closed issue #12277: jdk18下启动dubbo,会出现zookeeper地址解析失败的错误
URL: https://github.com/apache/dubbo/issues/12277
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org