简体   繁体   English

即使我有正确的jar,也要获取ClassNotFoundException

[英]Getting a ClassNotFoundException even though I have the correct jar

This is from my pom.xml: 这来自我的pom.xml:

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.9</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
    </dependency>

And this is from my error message: 这是从我的错误消息:

java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook not 

found by poi-ooxml [355]

I don't see any error messages on my Spring Tool Suite(very similar to Eclipse), and POI libraries are successfully imported. 我在Spring Tool Suite上没有看到任何错误消息(非常类似于Eclipse),并且POI库已成功导入。 I really can't understand why am I getting this error. 我真的不明白为什么我会收到此错误。

Also the code runs in an OSGi bundle, and poi jars are deployed along others. 此外,代码在OSGi捆绑软件中运行,并且poi jar与其他部署在一起。

UPDATE: Ok I have found something: The error says: 更新:好的,我发现了一些东西:错误显示:

java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook not 

found by poi-ooxml [355]

But my Workbook.class is inside of poi instead of poi-ooxml. 但是我的Workbook.class位于poi内部,而不是poi-ooxml。 How do I make maven to look inside of poi instead of poi-ooxml? 我如何使Maven在poi内部而不是poi-ooxml中查找?

Your question is not very clear... Are you using Eclipse when this error occur or maven? 您的问题不是很清楚...发生此错误或使用Maven时是否正在使用Eclipse?

Usually, the best thing is to run 通常,最好的事情是跑步

mvn clean install

in the home directory of pom.xml and this will give you a lot more information pom.xml的主目录中,这将为您提供更多信息

Usually when you have an error such ClassNotFoundException it means that you miss a dependency in the pom.xml. 通常,当您遇到诸如ClassNotFoundException之类的错误时,这意味着您会错过pom.xml中的依赖项。

Go over all your dependencies and check what is missing in the pom. 查看所有依赖项,检查pom中缺少的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取java.lang.ClassNotFoundException,即使我已经使用-cp指定了正确的jar - Getting a java.lang.ClassNotFoundException even though i've specified the correct jar with -cp 尽管jar在类路径中,但获取ClassNotFoundException - Getting ClassNotFoundException though jar is in classpath ClassNotFoundException,即使包含JAR是构建的一部分 - ClassNotFoundException, even though the containing JAR is part of the build ClassNotFoundException 即使 jar tvf 显示“缺少”类 - ClassNotFoundException even though jar tvf shows the 'missing' class ClassNotFoundException,即使包含该类的jar正确存在于类路径中 - ClassNotFoundException even though the jar containing the class is properly present in the classpath Java Jar ClassNotFoundException即使存在依赖库 - Java Jar ClassNotFoundException even though dependent library exists 即使主签名正确,也会出现“类没有接受String []的静态void main方法”错误 - Getting “class does not have a static void main method accepting String[]” error even though main signature is correct ClassNotFoundException即使该类已正确定义(我认为) - ClassNotFoundException even though the class is properly defined (I think) ClassNotFoundException 即使我不使用 class - ClassNotFoundException even though I don't use that class 我收到“java.lang.ClassNotFoundException: com.google.gson.Gson”错误,即使它是在我的类路径中定义的 - I am getting “java.lang.ClassNotFoundException: com.google.gson.Gson” error even though it is defined in my classpath
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM