Skip to content

Commit f85c8e3

Browse files
authored
[Issue-81] Gracefully handle missing dependencies. (#82)
* [ISSUE-81] catch NoClassDefFoundError errors and bubble up appropriately * [ISSUE-81] Update changelog * Add missing changelog entries * [ISSUE-81] Add more helpful exception error msg
1 parent cfef45a commit f85c8e3

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
33
and this project adheres to [Semantic Versioning](http://semver.org/).
44

55
## 1.0.5 (UNRELEASED)
6-
- [Issue#75](https://github.com/SourceLabOrg/kafka-webview/issues/75) Bugfix Add Jackson serializer that falls back to using toString() when consuming entries from Kafka.
6+
- [Issue#75](https://github.com/SourceLabOrg/kafka-webview/issues/75) Bugfix Add Jackson serializer that falls back to using toString() when consuming entries from Kafka.
7+
- [Issue#72](https://github.com/SourceLabOrg/kafka-webview/issues/72) Bugfix User role input not displayed when creating new user.
8+
- [Issue#81](https://github.com/SourceLabOrg/kafka-webview/issues/81) Bugfix Handle NoClassDefFoundError exceptions gracefully.
9+
- [Issue#74](https://github.com/SourceLabOrg/kafka-webview/issues/74) Improvement UI Tweak to display large number of partitions in datatable views.
10+
- [Issue#71](https://github.com/SourceLabOrg/kafka-webview/issues/71) Improvement Topics sorted in select boxes.
711

812
## 1.0.4 (06/11/2018)
913
- Update NPM dependencies for [CVE-2017-18214](https://nvd.nist.gov/vuln/detail/CVE-2017-18214).

kafka-webview-ui/src/main/java/org/sourcelab/kafka/webview/ui/manager/plugin/PluginFactory.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ public T getPlugin(final String jarName, final String classpath) throws LoaderEx
122122
final Class<? extends T> dClass = getPluginClass(jarName, classpath);
123123
try {
124124
return dClass.newInstance();
125-
} catch (InstantiationException | IllegalAccessException e) {
125+
} catch (final NoClassDefFoundError e) {
126+
// Typically this happens if the uploaded JAR references some dependency that was
127+
// not package in the JAR. Attempt to provide a useful error msg.
128+
final String errorMsg = e.getMessage()
129+
+ " - Does your JAR include all of its required dependencies? "
130+
+ "See https://github.com/SourceLabOrg/kafka-webview-examples#packaging-a-jar";
131+
throw new LoaderException(errorMsg, e);
132+
} catch (final InstantiationException | IllegalAccessException e) {
126133
throw new LoaderException(e.getMessage(), e);
127134
}
128135
}

kafka-webview-ui/src/main/java/org/sourcelab/kafka/webview/ui/manager/plugin/exception/LoaderException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class LoaderException extends Exception {
3131
/**
3232
* Constructor.
3333
*/
34-
public LoaderException(final String message, final Exception cause) {
34+
public LoaderException(final String message, final Throwable cause) {
3535
super(message, cause);
3636
}
3737

0 commit comments

Comments
 (0)