Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

ISSUE-15349: DnsResolverUtil "Cannot get DNS TTL settings from sun.net.InetAddressCachePolicy class" in Java 17 #4140

Open
sijie opened this issue Apr 27, 2022 · 1 comment
Labels

Comments

@sijie
Copy link
Member

sijie commented Apr 27, 2022

Original Issue: apache#15349


Describe the bug

DnsResolverUtil fails to get existing DNS TTL settings. This happens in Java 17. Error message:

WARN  org.apache.pulsar.common.util.netty.DnsResolverUtil - Cannot get DNS TTL settings from sun.net.InetAddressCachePolicy class
  java.lang.IllegalAccessException: class org.apache.pulsar.common.util.netty.DnsResolverUtil cannot access class sun.net.InetAddressCachePolicy (in module java.base) because module java.base does not export sun.net to unnamed module @3932c79a
  	at jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392) ~[?:?]
  	at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) ~[?:?]
  	at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
  	at org.apache.pulsar.common.util.netty.DnsResolverUtil.<clinit>(DnsResolverUtil.java:46) ~[org.apache.pulsar-pulsar-common-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
  	at org.apache.pulsar.client.impl.ConnectionPool.createDnsNameResolver(ConnectionPool.java:116) ~[org.apache.pulsar-pulsar-client-original-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]

To Reproduce

Use Pulsar Java Client in Java 17

Expected behavior

Pulsar Java Client should be able to detect DNS TTL settings used in Java and apply them to Netty's DnsNameResolverBuilder.

Additional context
apache#15219

@sijie sijie added the type/bug label Apr 27, 2022
@z81690074
Copy link

我也遇到这个问题了,可以正常使用pulsar,但是启动会抛这个异常
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants