Sorry about the noise.
Fixed it - was just an error in the pom.xml.
Marco

Am 10.02.2018 um 22:38 schrieb Marco Lechner - FOSSGIS e.V.:
> Hi,
>
> started using org.apache.poi.xwpf version 3.16 (defined as dependency in
> projects pom.xml). When I test my application in my IDE (idea) it works
> like a charm, but when I try to run the compiled jar from commandline using
>
> $ java -jar target/dokpool-faq-importer.jar ./test/FAQs.docx
>
> I get the following error message:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/poi/xwpf/usermodel/XWPFDocument
>     at de.bfs.dokpool.faq.importer.FaqImporter.main(FaqImporter.java:23)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.poi.xwpf.usermodel.XWPFDocument
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>     ... 1 more
>
> The as far as I know relevant dependency packages seem to be included in
> the jar-file. Tried with unzip -l:
>
> $ unzip -l target/dokpool-faq-importer.jar
> Archive:  target/dokpool-faq-importer.jar
>   Length      Date    Time    Name
> ---------  ---------- -----   ----
>       411  2018-02-09 22:18   META-INF/MANIFEST.MF
>         0  2018-02-09 22:18   META-INF/
>         0  2018-02-09 22:18   de/
>         0  2018-02-09 22:18   de/bfs/
>         0  2018-02-09 22:18   de/bfs/dokpool/
>         0  2018-02-09 22:18   de/bfs/dokpool/faq/
>         0  2018-02-09 22:18   de/bfs/dokpool/faq/importer/
>         0  2018-02-09 22:18   lib/
>         0  2018-02-09 22:18   META-INF/maven/
>         0  2018-02-09 22:18   META-INF/maven/de.bfs/
>         0  2018-02-09 22:18   META-INF/maven/de.bfs/dokpool-faq-importer/
>      1227  2018-02-09 22:18  
> de/bfs/dokpool/faq/importer/FaqSchluesselBotschaft.class
>      1183  2018-02-09 22:18  
> de/bfs/dokpool/faq/importer/FaqBotschaften.class
>    190432  2018-02-09 22:18   lib/gson-2.2.4.jar
>    751238  2018-02-09 22:18   lib/commons-collections4-4.1.jar
>     26514  2018-02-09 22:18   lib/stax-api-1.0.1.jar
>   1433719  2018-02-09 22:18   lib/poi-ooxml-3.16.jar
>      4824  2018-02-09 22:17  
> META-INF/maven/de.bfs/dokpool-faq-importer/pom.xml
>        99  2018-02-09 22:18  
> META-INF/maven/de.bfs/dokpool-faq-importer/pom.properties
>      2919  2018-02-09 22:18   de/bfs/dokpool/faq/importer/FaqImporter.class
>      2224  2018-02-09 22:18   de/bfs/dokpool/faq/importer/Faq.class
>   2730866  2018-02-09 22:18   lib/xmlbeans-2.6.0.jar
>      4946  2018-02-09 22:18   de/bfs/dokpool/faq/importer/FaqUtils.class
>   5871746  2018-02-09 22:18   lib/poi-ooxml-schemas-3.16.jar
>      3124  2018-02-09 22:18  
> de/bfs/dokpool/faq/importer/FaqTableParser.class
>    284184  2018-02-09 22:18   lib/commons-codec-1.10.jar
>     98365  2018-02-09 22:18   lib/curvesapi-1.04.jar
>   2679259  2018-02-09 22:18   lib/poi-3.16.jar
> ---------                     -------
>  14087280                     28 files
>
> What can be the reason? Any idea why
> org/apache/poi/xwpf/usermodel/XWPFDocument is not found? My
> FaqImporter.java main() looks like this:
>
> package de.bfs.dokpool.faq.importer;
>
> ...
> import org.apache.poi.xwpf.usermodel.XWPFDocument;
> import org.apache.poi.xwpf.usermodel.XWPFTable;
> import org.apache.poi.openxml4j.opc.OPCPackage;
>
> import java.io.FileInputStream;
> import java.util.ArrayList;
> import java.util.List;
>
> public class FaqImporter {
>
>     public static void main(String[] args) {
>         String docxpath = args[0];
>         List<Faq> faqCatalog = new ArrayList<Faq>();
>
>         try {
>             FileInputStream fis = new FileInputStream(docxpath);
>             XWPFDocument xdoc = new XWPFDocument(OPCPackage.open(fis));
>             List<XWPFTable> xwpfTables = xdoc.getTables();
> ...
>
> Shouldn't this be enough?
>
> Javav ersion is
>
> $ java -version
> java version "1.8.0_161"
> Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
>
> Marco
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
> For additional commands, e-mail: user-h...@poi.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to