gpt4 book ai didi

java.lang.RuntimeException : java. lang.ClassNotFoundException :

转载 作者:搜寻专家 更新时间:2023-11-01 02:48:06 25 4
gpt4 key购买 nike

我得到以下新的异常 cobertura (2.0.2..) .我想这与在新 block 中立即创建新对象有某种关系。

WARN   instrumentClass, Unable to instrument file c:\apps\ijprojects\TrickyInstrument\out\production\TrickyInstrument\InstrumentationFailsOnFirstNewClassInTryBlock.class
java.lang.RuntimeException: java.lang.ClassNotFoundException: DataAccess
at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source)
at org.objectweb.asm.ClassWriter.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
at org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:204)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:121)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.addInstrumentationToSingleClass(CoberturaInstrumenter.java:233)
at net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:274)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:283)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:292)
at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:373)
at net.sourceforge.cobertura.instrument.Main.main(Main.java:395)
8 Jul, 2013 2:05:07 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
INFO: Cobertura: Saved information on 2 classes.

以下是与上述异常相关的代码。

public class InstrumentationFailsOnFirstNewClassInTryBlock {


public void saveToDatabase() {
//
try {
// boolean b=false;
// if ( b) {
// System.out.println("no action");
// }
DataAccess da = new DataAccess();
System.out.println("nothing");

} catch (Exception e) {


}
}
}
class DataAccess {
public DataAccess() {
//To change body of created methods use File | Settings | File Templates.
}
}

如果我取消注释代码块中的一些伪语句,那么检测工作正常。有人看过这个吗?任何潜在的修复?

编辑:java6 和 java7 出现错误。

最佳答案

最初的问题是由于 Cobertura 缺陷造成的。它不是固定的。 Cobertura 现在支持 auxillary classpath. 的附加参数.这将用于解析检测所需的任何类。

cobertura-ant task documentation

Adding auxClasspath

auxClasspath argument is designed to remove the ClassNotFoundException during instrumentation. See https://github.com/cobertura/cobertura/wiki/FAQ#classnotfoundexception-during-instrumentation for more information on this argument

关于java.lang.RuntimeException : java. lang.ClassNotFoundException : <org. objectweb.asm.ClassWriter.getCommonSuperClass(未知来源)>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17522385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com