使用 Jackcess Encrypt 导致 Cobertura 出现 "NoClassDefFoundError" 异常
Using Jackcess Encrypt causes "NoClassDefFoundError" exception for Cobertura
我正在尝试使用一个非常简单的程序读取带有 jet 编码的 mdb 文件。
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();
}
}
}
并且我有以下库附加功能
- 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
当我 运行 程序时出现以下错误
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
我尝试使用以下 Bouncy crypt 库
- bcprov-jdk15on-157.jar
- bcprov-jdk15on-152.jar
- bcprov-jdk15on-151.jar
- bcprov-jdk15on-150.jar
- bcprov-jdk15on-149.jar
最后我解决了我更改库 jackcess-encrypt-2.1 的问题。2.jar by jackcess-encrypt-2.1.0.jar.
我不知道为什么,但这让我有可能完成这项工作。
应该在 jackcess-encrypt 2.1.3 版本中修复。
我正在尝试使用一个非常简单的程序读取带有 jet 编码的 mdb 文件。
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();
}
}
}
并且我有以下库附加功能
- 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
当我 运行 程序时出现以下错误
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
我尝试使用以下 Bouncy crypt 库
- bcprov-jdk15on-157.jar
- bcprov-jdk15on-152.jar
- bcprov-jdk15on-151.jar
- bcprov-jdk15on-150.jar
- bcprov-jdk15on-149.jar
最后我解决了我更改库 jackcess-encrypt-2.1 的问题。2.jar by jackcess-encrypt-2.1.0.jar.
我不知道为什么,但这让我有可能完成这项工作。
应该在 jackcess-encrypt 2.1.3 版本中修复。