Skip to content

Conversation

@GuiSong01
Copy link
Contributor

[Bug] fix bug kafka-reporter-plugin-8.15.0 throw exception "java.lang.NoClassDefFoundError: com/google/gson/Gson"

Fix apache/skywalking#10848

  • Add a unit test to verify that the fix works.
  • Explain briefly why the bug exists and how to fix it.

skywalking-java support to decrypt password of kafka with SASL_SSL enabled

  • If this is non-trivial feature, paste the links/URLs to the design doc.

  • Update the documentation to include this new feature.

  • Tests(including UT, IT, E2E) are added to verify the new feature.

  • If it's UI related, attach the screenshots below.

  • Closes #<10848>.

  • Update the CHANGES log.

…and fix bug `kafka-reporter-plugin-8.15.0 throw exception "java.lang.NoClassDefFoundError: com/google/gson/Gson"`
CHANGES.md Outdated
* Support Grizzly Trace
* Fix possible IllegalStateException when using Micrometer.

* Support to config custom decryption methods for kafka configurations and fix bug `kafka-reporter-plugin-8.15.0 throw exception "java.lang.NoClassDefFoundError: com/google/gson/Gson"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be two features, rather than one.

| `plugin.kafka.topic_management` | Specify which Kafka topic name for the register or heartbeat data of Service Instance to report to. | SW_PLUGIN_KAFKA_TOPIC_MANAGEMENT | `skywalking-managements` |
| `plugin.kafka.topic_logging` | Specify which Kafka topic name for the logging data to report to. | SW_PLUGIN_KAFKA_TOPIC_LOGGING | `skywalking-logging` |
| `plugin.kafka.namespace` | isolate multi OAP server when using same Kafka cluster (final topic name will append namespace before Kafka topics with `-` ). | SW_KAFKA_NAMESPACE | `` |
| `plugin.kafka.decrypt_class` | Specify which class to decrypt encrypted configuration of kafka.You can set encrypted information in `plugin.kafka.producer_config_json` or `plugin.kafka.producer_config` if you need. | SW_KAFKA_DECRYPT_CLASS | `` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://skywalking.apache.org/docs/skywalking-java/next/en/setup/service-agent/java-agent/advanced-reporters/

This doc should be updated as well, including

  1. Which artifact and version should the developer depend on to develop this? Which interface should be implemented?
  2. Where to put the packaged codes

@wu-sheng wu-sheng changed the title Support to config custom decryption methods for kafka configurations and fix bug kafka-reporter-plugin-8.15.0 throw exception "java.lang.NoClassDefFoundError: com/google/gson/Gson" Support to config custom decryption methods for kafka configurations and fix bug kafka-reporter-plugin exception "java.lang.NoClassDefFoundError: com/google/gson/Gson"` May 25, 2023
@wu-sheng wu-sheng added bug Something isn't working feature labels May 25, 2023
@wu-sheng wu-sheng added this to the 8.16.0 milestone May 25, 2023
Comment on lines +150 to +156
Class<?> decryptClazz = Class.forName(Kafka.DECRYPT_CLASS);
Method decryptMethod = decryptClazz.getMethod(Kafka.DECRYPT_METHOD, Map.class);
return (Map<String, String>) decryptMethod.invoke(decryptClazz.newInstance(), config);
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
// ignore
LOGGER.warn("The decrypt class {} is not exist, exception:{}.", Kafka.DECRYPT_CLASS, e);
return config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to do in this way, please indicate in the docs, what method should be written.

@wu-sheng
Copy link
Member

Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.2.1:check (validate) on project kafka-reporter-plugin: You have 2 Checkstyle violations. -> [Help 1]

You should do code style check.

@wu-sheng
Copy link
Member

As this PR is not updated, GSON part is being fixed by #538 as well.

@GuiSong01
Copy link
Contributor Author

Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.2.1:check (validate) on project kafka-reporter-plugin: You have 2 Checkstyle violations. -> [Help 1]

You should do code style check.

@GuiSong01 GuiSong01 closed this May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] kafka-reporter-plugin-8.15.0 throw exception "java.lang.NoClassDefFoundError: com/google/gson/Gson"

2 participants