问题
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