NoClassDefFoundError when run plugin
Hi, I'm implementing a Datalist Action plugin. Everything worked well until l I included an external library. After that I get a NoClassDefFoundError exception (org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller).
This is the pom.xml file I'm using to compile the plugin (with the command 'mvn package').
And this is the jar resulting from the compilation process. If I look in the dependency folder I find the poi-ooxml-3.17, and it contains the org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller.class file.
If someone want to try to run the plugin it can be run on whatever datalist (fill randomly the mandatory options, I'm not using them yet). You can see the exception in the log file (mine is at /usr/local/tomcat/logs/joget.log)
This is the java file with the plugin implementation:
public class GenerateNewDocumentVersionDatalistAction extends DataListActionDefault {
private final static String MESSAGE_PATH = "messages/GenerateNewDocumentVersionDatalistAction";
public DataListActionResult executeAction(DataList arg0, String[] arg1) {
XWPFDocument xdoc = null;
try {
xdoc = new XWPFDocument();
} catch (Throwable e1){
LogUtil.error("Collaborative Editing - Generate new document version plugin", e1, "Error creating xwpf document");
}
return null;
}
public String getConfirmation() {
return getPropertyString("confirmation"); //get confirmation from configured properties options
}
public String getHref() {
return getPropertyString("href"); //Let system to handle to post to the same page
}
public String getHrefColumn() {
String recordIdColumn = getPropertyString("recordIdColumn"); //get column id from configured properties options
if ("id".equalsIgnoreCase(recordIdColumn) || recordIdColumn.isEmpty()) {
return getPropertyString("hrefColumn"); //Let system to set the primary key column of the binder
} else {
return recordIdColumn;
}
}
public String getHrefParam() {
return getPropertyString("hrefParam"); //Let system to set the parameter to the checkbox name
}
public String getLinkLabel() {
return getPropertyString("label"); //get label from configured properties options
}
public String getTarget() {
return "post";
}
public String getClassName() {
return getClass().getName();
}
public String getLabel() {
return AppPluginUtil.getMessage("org.joget.tutorial.GenerateNewDocumentVersionDatalistAction.pluginLabel", getClassName(), MESSAGE_PATH);
}
public String getPropertyOptions() {
return AppUtil.readPluginResource(getClassName(), "/properties/generateNewDocumentVersionDatalisAction.json", null, true, MESSAGE_PATH);
}
public String getDescription() {
return AppPluginUtil.getMessage("org.joget.tutorial.GenerateNewDocumentVersionDatalistAction.pluginDesc", getClassName(), MESSAGE_PATH);
}
public String getName() {
return "New Document Generator Datalist Action";
}
public String getVersion() {
return "5.0.0";
}
If someone can point out why this code rises this exception, please, let me know.