java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46034557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:01:45  来源:igfitidea点击:

java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils

javacsvnoclassdeffounderroropencsv

提问by Indieaiden

I'm trying to code a program to read a CSV file and then make some stuff with it. I've searching a lot, and finally I found out thislibrary.

我正在尝试编写一个程序来读取 CSV 文件,然后用它制作一些东西。我搜索了很多,最后我找到了这个库。

Some days ago I finished the code, and everything worked fine. Today I updated the library to the 4.0 v, and then a lot of warnings popped out.

几天前我完成了代码,一切正常。今天我将库更新到 4.0 v,然后弹出了很多警告。

I made some testing and the part that fails is:

我做了一些测试,失败的部分是:

public void LeerCSV(File CSVCat, File CSVProd){  
//Creo un objeto de la clase FileReader que me hace falta para los CSVReader
CSVReaderBuilder lectorCatBuilder = null;
CSVReaderBuilder lectorProdBuilder = null;

CSVReader CatReader = null;
CSVReader ProdReader = null;

CSVParser CatParser = null;
CSVParser ProdParser = null;
        //Vamos a intentar abrirlos y operar con ellos 

try {
    //Se crea una especie de "constructor" para crear los lectores de archivos.
    //para ello, antes se le pasan todos los atributos que queramos        

   CatParser =
   new CSVParserBuilder()
   .withSeparator(SEPARADOR)
   .withIgnoreQuotations(true)
   .build();
   CatReader =
   new CSVReaderBuilder(new FileReader(CSVCat))
   .withSkipLines(1)
   .withCSVParser(CatParser)
   .build();

   ProdParser =
   new CSVParserBuilder()
   .withSeparator(SEPARADOR)
   .withIgnoreQuotations(true)
   .build();
   ProdReader =
   new CSVReaderBuilder(new FileReader(CSVProd))
   .withSkipLines(1)
   .withCSVParser(ProdParser)
   .build();

This one.

这个。

The warnings are:

警告是:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: 
org/apache/commons/lang3/ObjectUtils
at com.opencsv.CSVParser.<init>(CSVParser.java:207)
at com.opencsv.CSVParserBuilder.build(CSVParserBuilder.java:138)
...
...
Caused by: java.lang.ClassNotFoundException: 
org.apache.commons.lang3.ObjectUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

This ones.

这些。

I know that is a library problem but I don't know what library is causing it, or if I need to update or install something.

我知道这是一个库问题,但我不知道是什么库导致了它,或者我是否需要更新或安装某些东西。

Thank you very much.

非常感谢你。

采纳答案by Stéphane Ammar

It's seem that you are not using apache commons lang3 library : https://mvnrepository.com/artifact/org.apache.commons/commons-lang3

您似乎没有使用 apache commons lang3 库:https://mvnrepository.com/artifact/org.apache.commons/commons-lang3