Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][client] Swallow Conscrypt ClassNotFoundException #20371

Merged
merged 3 commits into from
May 24, 2023

Conversation

nicoloboschi
Copy link
Contributor

Motivation

When Conscrypt isn't availabe in the classpath a ClassNotFoundException is raised. However this is a optional dependency and so the client continue working using the JDK default security provider.

The "problem" is that the whole stacktrace is printed in the logs and it can be very scary for the users.

│ java.lang.ClassNotFoundException: org.conscrypt.Conscrypt                                                                                                                                                                                                                             │
│     at jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) ~[?:?]                                                                                                                                                                                                        │
│     at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) ~[?:?]                                                                                                                                                                                               │
│     at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]                                                                                                                                                                                                                         │
│     at java.lang.Class.forName0(Native Method) ~[?:?]                                                                                                                                                                                                                                 │
│     at java.lang.Class.forName(Unknown Source) ~[?:?]                                                                                                                                                                                                                                 │
│     at org.apache.pulsar.common.util.SecurityUtility.loadConscryptProvider(SecurityUtility.java:124) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]                                                                                                                          │
│     at org.apache.pulsar.common.util.SecurityUtility.<clinit>(SecurityUtility.java:81) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]                                                                                                                                        │
│     at org.apache.pulsar.client.admin.internal.http.AsyncHttpConnector.<init>(AsyncHttpConnector.java:163) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]                                                                                                                    │
│     at org.apache.pulsar.client.admin.internal.http.AsyncHttpConnectorProvider.getConnector(AsyncHttpConnectorProvider.java:52) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]                                                                                               │
│     at org.apache.pulsar.client.admin.internal.PulsarAdminImpl.<init>(PulsarAdminImpl.java:202) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]                                                                                                                               │
│     at org.apache.pulsar.client.admin.internal.PulsarAdminBuilderImpl.build(PulsarAdminBuilderImpl.java:48) ~[flink-sql-connector-pulsar-1.16.0.0.0.jar:1.16.0.0.0]

Modifications

Do not print the stacktrace in case of ClassNotFoundException

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 23, 2023
@nodece nodece merged commit 2e6928a into apache:master May 24, 2023
@Technoboy- Technoboy- added this to the 3.1.0 milestone May 28, 2023
@lhotari
Copy link
Member

lhotari commented Sep 2, 2024

It would be better to address this also for 3.0.x LTS release branch. The current verbose exception logging is causing confusion for Pulsar client users.

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

Successfully merging this pull request may close these issues.

4 participants