I tried injecting a method call statement using javassist in every method of some desired classes. The statement corresponds to a class in the java-agent jar. For example if my agent has class like a.b.HelperClass, I am injecting a.b.HelperClass.call(); in the beginning of every class using javassist.
I tried with a spring boot web app and the agent works fine but with RCP application it is throwing
java.lang.ClassNotFoundException: a.b.HelperClass at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Do I need to load the classes residing inside agent-jar using the eclipse class loader? BTW I'm instrumenting by calling agent-main method and not premain.