You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bo...@gmail.com,
bo...@gmail.com on 2018/09/20 08:51:42 UTC
java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
Hello everybody!
I'm writing my project with using apache.poi.
I encountered such a problem:
my project works wonderfully in the idea, but when you build maven and run the jar file it gives an error.
I tried to solve this problem in various ways:
- used different versions (3.9, 3.12, 3.17, 4.00)
- I put hands on the library inside the compiled project
- registered in maven as a local repository and went to a certain place.
The project does not start.
I ask you to help me and direct me in the right way
my project - https://github.com/Dmytrius/reportmail
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
Posted by bo...@gmail.com,
bo...@gmail.com.
On 2018/09/20 11:44:06, "pj.fanning" <fa...@yahoo.com> wrote:
> I'm not sure why you need to load poi differently from xmlbeans. The xmlbeans
> is correct but your poi dependencies are nothing like anything I've ever
> seen.
> Could you use the standard pom settings?
>
> <dependency>
> <groupId>org.apache.poi</groupId>
> <artifactId>poi-ooxml</artifactId>
> <version>4.0.0</version>
> </dependency>
>
>
>
> --
> Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
> If I understood you correctly,
method did not work, error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
at autoreportmail.Run.run(App.java:42)
at autoreportmail.App.main(App.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
my pom.xml:
<dependencies>
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird-jdk18</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>8</source>
<target>8</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_181\bin\javac</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>autoreportmail.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: java.lang.ClassNotFoundException:
org.apache.poi.ss.usermodel.Workbook
Posted by "pj.fanning" <fa...@yahoo.com>.
I'm not sure why you need to load poi differently from xmlbeans. The xmlbeans
is correct but your poi dependencies are nothing like anything I've ever
seen.
Could you use the standard pom settings?
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
</dependency>
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
Posted by bo...@gmail.com,
bo...@gmail.com.
On 2018/09/20 13:54:15, "pj.fanning" <fa...@yahoo.com> wrote:
> Somehow you've disabled the standard transitive dependency loading mechanisms
> in your maven build.
>
> Try adding:
> <dependency>
> <groupId>org.apache.poi</groupId>
> <artifactId>poi</artifactId>
> <version>4.0.0</version>
> </dependency>
>
> But without transitive dependency loading, you're going to have to
> explicitly add lots of dependencies.
>
>
>
> --
> Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>
thanks for the help, but something else helped me:
1. As though I did not change my pom file - a tangible result is not given.
2. when I put files of poi and poi-ooxml into one folder with my jar file - the application worked.
3. Without the libraries in the folder, the application refuses to work so that I do not apply it.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: java.lang.ClassNotFoundException:
org.apache.poi.ss.usermodel.Workbook
Posted by "pj.fanning" <fa...@yahoo.com>.
Somehow you've disabled the standard transitive dependency loading mechanisms
in your maven build.
Try adding:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
But without transitive dependency loading, you're going to have to
explicitly add lots of dependencies.
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org