javams-accessjackcess

Using Jackcess Encrypt causes "NoClassDefFoundError" exception for Cobertura


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

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


Solution

  • 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.