Using Jackcess Encrypt causes “NoClassDefFoundError” exception for Cobertura

余生长醉 提交于 2019-12-02 17:04:00

问题


I'm trying to read a mdb file with jet encode with a very simple program.

import java.io.File;
import java.io.IOException;

import com.healthmarketscience.jackcess.CryptCodecProvider;
import com.healthmarketscience.jackcess.Database;
import com.healthmarketscience.jackcess.DatabaseBuilder;
import com.healthmarketscience.jackcess.Row;
import com.healthmarketscience.jackcess.Table;

public class ReadFile {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try {
        File myDbFile = new File("C:\\Users\\jcace\\Downloads\\TSC\\DB1.mdb");
        Database db = new DatabaseBuilder(myDbFile)
                  .setCodecProvider(new CryptCodecProvider())
                  .open();
    Table table = db.getTable("VBV");
    for(Row row : table) {
        System.out.println("Look ma, a row: " + row);
      }
    } catch (IOException e){
        e.printStackTrace();
    }
   }
}

and I have the following library extras

  • commons-logging-1.2\commons-logging-1.2.jar
  • commons-logging-1.2\commons-logging-1.2-javadoc.jar
  • commons-lang-2.6\commons-lang-2.6.jar
  • jackcess-encrypt-2.1.2.jar
  • hamcrest-core-1.3.jar
  • junit-4.11.jar
  • jackcess-2.1.0.jar
  • bcprov-jdk15on-1.49.jar

And when I ran the program I have the following Error

Exception in thread "main" java.lang.NoClassDefFoundError: 
net/sourceforge/cobertura/coveragedata/TouchCollector
at com.healthmarketscience.jackcess.CryptCodecProvider.__cobertura_init(CryptCodecProvider.java)
at com.healthmarketscience.jackcess.CryptCodecProvider.<clinit>(CryptCodecProvider.java)
at HelloWorld.main(HelloWorld.java:17)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.TouchCollector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more

I try with the following Bouncy crypt library

  • bcprov-jdk15on-157.jar
  • bcprov-jdk15on-152.jar
  • bcprov-jdk15on-151.jar
  • bcprov-jdk15on-150.jar
  • bcprov-jdk15on-149.jar

回答1:


Finally I solved my problem changing the library jackcess-encrypt-2.1.2.jar by jackcess-encrypt-2.1.0.jar.

I don´t know why but this made me possible did this work.




回答2:


Should be fixed in the jackcess-encrypt 2.1.3 release.



来源:https://stackoverflow.com/questions/44681232/using-jackcess-encrypt-causes-noclassdeffounderror-exception-for-cobertura

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!