Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Problem with WeavingHook starting too late
Problem with WeavingHook starting too late [message #1066011] Fri, 28 June 2013 20:45 Go to next message
Gerald Rosenberg is currently offline Gerald RosenbergFriend
Messages: 106
Registered: July 2009
Senior Member
I am using Eclipse 4.3 and ObjectWeb ASM in a plugin to add some low level instrumentation to "org.eclipse.swt.widgets.Display".

When I launch the Eclipse workbench as an Eclipse application, the plugin works correctly: my WeavingHook method is called with classes as they are being loaded, beginning shortly before the loading of Display.class.

The problem is, after my plugin has been installed using P2, the calls to WeavingHook start after Display.class has already been loaded.

My weavinghook.xml specifies enabled="true" immediate="true"
I have set the plugin to be "unpacked" after installation with P2.

Is there a way to ensure that my weaving hook is activated before a specific class or bundle is loaded?

Any idea of what is causing the problem?

Thanks...
Re: Problem with WeavingHook starting too late [message #1066023 is a reply to message #1066011] Sat, 29 June 2013 03:43 Go to previous messageGo to next message
BJ Hargrave is currently offline BJ HargraveFriend
Messages: 60
Registered: July 2009
Member
You will probably need to use start levels to make sure your weaving hook bundle is started before other bundles which load classes you want to weave.
Re: Problem with WeavingHook starting too late [message #1066080 is a reply to message #1066023] Sun, 30 June 2013 03:50 Go to previous messageGo to next message
Gerald Rosenberg is currently offline Gerald RosenbergFriend
Messages: 106
Registered: July 2009
Senior Member
Thanks for the pointer.

Is there a way to specify a start level for an "ordinary" plugin? That is, I am not building an RCP or other product. All of the reference uses of start level that I have found by Googling are specific to product builds.
Re: Problem with WeavingHook starting too late [message #1066447 is a reply to message #1066023] Tue, 02 July 2013 17:01 Go to previous messageGo to next message
Gerald Rosenberg is currently offline Gerald RosenbergFriend
Messages: 106
Registered: July 2009
Senior Member
Guessing a bit, but without a clear success -- that is, I cannot tell if it is being recognized or is in someway not correct/sufficient to change the start level. Here is my p2.inf file, as stored in the MANIFEST.MF directory of my weaving plugin.

#create a requirement on the fragment we are creating  
requires.0.namespace=org.eclipse.equinox.p2.iu  
requires.0.name=configure.net.certiv.bent.core
requires.0.greedy=true  
      
#create a IU fragment named configure.net.certiv.bent.core
units.0.id=configure.net.certiv.bent.core  
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=configure.net.certiv.bent.core
units.0.instructions.install=org.eclipse.equinox.p2.touchpoint.eclipse.installBundle(bundle:${artifact});  
units.0.instructions.uninstall=org.eclipse.equinox.p2.touchpoint.eclipse.uninstallBundle(bundle:${artifact});  
units.0.instructions.unconfigure=org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:-1); org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:false);  
units.0.instructions.configure=org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:1);org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:true);

# add multiple sets of host requirements to ensure this p2.inf is selected
units.0.hostRequirements.1.namespace=osgi.bundle
units.0.hostRequirements.1.name=net.certiv.bent.core
units.0.hostRequirements.1.greedy=false

units.0.hostRequirements.2.namespace=org.eclipse.equinox.p2.eclipse.type
units.0.hostRequirements.2.name=bundle
units.0.hostRequirements.2.range=[1.0.0,2.0.0)
units.0.hostRequirements.2.greedy=false

units.0.requires.1.namespace=osgi.bundle
units.0.requires.1.name=net.certiv.bent.core
units.0.requires.1.greedy=false


Any suggestions as to what to change or try next would be appreciated.

Thanks...
Re: Problem with WeavingHook starting too late [message #1066448 is a reply to message #1066447] Tue, 02 July 2013 17:02 Go to previous message
Gerald Rosenberg is currently offline Gerald RosenbergFriend
Messages: 106
Registered: July 2009
Senior Member
Should say, META-INF directory.
Previous Topic:Add maven NAR files to Target Platform
Next Topic:p2 installation question
Goto Forum:
  


Current Time: Fri Apr 26 14:00:56 GMT 2024

Powered by FUDForum. Page generated in 0.03553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top