I'm using ASM to inject code to methods:
@Override
public void visitCode() {
visitMethodInsn(Opcodes.INVOKESTATIC, "sssss/CopyOfsss", "foo", "()V");
super.visitCode();
}
Exception in thread "main" java.lang.NoClassDefFoundError: sssss/CopyOfsss
at java.util.regex.Pattern$Node.match(Pattern.java)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
at java.util.regex.Pattern$Curly.match0(Pattern.java:3760)
at java.util.regex.Pattern$Curly.match(Pattern.java:3744)
at java.util.regex.Matcher.match(Matcher.java:1127)
at java.util.regex.Matcher.matches(Matcher.java:502)
at sssss.CopyOfsss.main(CopyOfsss.java:26)
please help~
NoClassDefFoundError(roughly) means the class was there on compile time, but not on runtime - do you perhaps have a classpath issue or a bungled JAR file here?CopyOfssssis loaded by a child classloader, makes a call in to a class loaded by its parent loader, and that class then tries to make a static call back toCopyOfsssssthen it will fail (the child CL can see classes loaded by the parent but not vice-versa).