ClassNotFoundException - missing external dependency
boilrmkr opened this issue · 2 comments
Hi,
I am trying to integrate yGuard with ant build script and have all the necessary jar files in the 'lib' folder. My code compiles correctly but yguard failing to complete its task by throwing ClassNotFoundException error message.
My code doesn't even use 'jpos.events.DataListener' class. I have the following two jpos jar files in the 'lib' folder and they are used by my code.
jpos111.jar
jpos111-controls.jar
I googled for jpos.events.DataListener class and found it's used in javapos-1.14.2.jar file and I copied that file to 'lib' folder and added that location to 'externalclasses' element but yGuard still fails.
I appreciate any suggestions.
<externalclasses>
<pathelement location="${lib.dir}/*.jar"/>
</externalclasses>
How do I fix this error?
build.xml:510: yGuard was unable to resolve a class (java.lang.ClassNotFoundException: jpos.events.DataListener).
Probably a missing external dependency.
at com.yworks.yguard.ObfuscatorTask.execute(ObfuscatorTask.java:1088)
at com.yworks.yguard.YGuardTask.execute(YGuardTask.java:118)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.Main.runBuild(Main.java:818)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.lang.ClassNotFoundException: jpos.events.DataListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:817)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.yworks.yguard.ObfuscatorTask$ResourceCpResolver.resolve(ObfuscatorTask.java:2371)
at com.yworks.yguard.obf.Cl.scanExtSupers(Cl.java:591)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:560)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:579)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:557)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Cl.java:544)
at com.yworks.yguard.obf.Cl.resolveOptimally(Cl.java:500)
at com.yworks.yguard.obf.ClassTree$4.classAction(ClassTree.java:593)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1665)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1658)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1650)
at com.yworks.yguard.obf.ClassTree.walkTree(ClassTree.java:1637)
at com.yworks.yguard.obf.ClassTree.resolveClasses(ClassTree.java:590)
at com.yworks.yguard.obf.GuardDB.createMap(GuardDB.java:805)
at com.yworks.yguard.obf.GuardDB.remapTo(GuardDB.java:334)
at com.yworks.yguard.ObfuscatorTask.execute(ObfuscatorTask.java:1064)
... 17 more
As per build.gradle
the following dependencies need to be available in your classpath
org.ow2.asm:asm:7.2
org.apache.ant:ant:1.10.7
com.yworks:annotation:3.0.0
Since you use ant
to invoke the task, it is already in the classpath, thus only implicitely required.