Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Classloading issue with javaagent and dedicated Eclipse application

I don't know about your exact situation but I know about the
difficulties of communicating between a javaagent and the rest
of the world.
I'm not sure if it is even possible to let regular classes "see"
the agent, given that the agent isn't actually on the classpath.
I believe you could get the communication established like this:
- let the agent store itself in a Object-typed field of a non-agent
  class that is visible to both sides (may need to be on the
  bootclasspath).
- let the regular class pick up that instance and invoke methods
  via reflection.

HTH,
Stephan

On 05/02/2013 04:29 PM, Tomljenovic Marko (CDG-SMT/EMT1) wrote:
Hi everybody,
I have a complex problem to solve and unfortunately I am out of ideas.
Hopefully you can help me.
My situation is like this:
I am using Eclipse 3.8 to run a headless Eclipse application (PDE
EclipseTestRunner).
In addition the jacoco javaagent is started via –javaagent parameter to
gather code coverage.
The Jacoco javaagent is implemented via a singleton pattern.
I have written a special class that is invoked automatically by the
headless application (during the tests). This special class is a
JUnitFormatter that is used for tweaking the code coverage data for a
testcase (storing for each test case a dedicated session within the
coverage data). For that the access to the Jacoco instance is necessary.
The formatter class is contained in a bundle fragment (of
org.eclipse.test) that has a dependency to ant and junit4.
The formatter class itself can be invoked (when specifying the host as
org.eclipse.test) but then I get an exception that the Jacoco agent
class(instance) cannot be found at all.
To solve this problem I played around (according to
http://blog.springsource.com/2009/01/19/exposing-the-boot-classpath-in-osgi/)
with system packages, extension bundles, boot delegation but none of it
worked. Either the agent class could not be found or even the
JunitFormatter class could not be found (I guess that in this case the
fragment could not be loaded due to certain dependencies).
Any idea how to solve that? Do I maybe need to change the parent
classloader when running the tests?
Thank you a lot in advance.
Marko


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




Back to the top