Bug 266951 - [jdt-weaving] Enable 'Weaving Service'
Summary: [jdt-weaving] Enable 'Weaving Service'
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 1.6.4   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 2.0.2   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-03 18:48 EST by Stefan Schmidt CLA
Modified: 2009-12-15 23:14 EST (History)
3 users (show)

See Also:


Attachments
screenshot (41.11 KB, image/png)
2009-03-03 18:48 EST, Stefan Schmidt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schmidt CLA 2009-03-03 18:48:04 EST
Created attachment 127407 [details]
screenshot

AJDT pops up a dialog to enable the 'Weaving Service' (screenshot attached). When I agreeing and restarting Eclipse it comes back up the dialog pops up again. 

I would assume that upon successful installation it would be gone. Going 
to Preferences after the restart the JDT weaving panel shows it's still disabled.

Temporary workarounds: 

Simple way:
1. open up plug-in registry view.
2. look for org.eclipse.equinox.weaving.aspectj
3. right click nd select "Show Advanced operations"
4. right click again and select start (if not already started)
5. restart

If it still doesn't start, then try this:
1. find the eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info file and open it in a text editor
2. find the line that says: org.eclispe.equinox.weaving.aspectj
3. change false to true
4. start eclipse

If all fails:
1. find the eclispe/configuration/config.ini file and open in a text editor
2. ensure that the line: osgi.framework.extensions=org.eclipse.equinox.weaving.hook is present
3. in the line that starts osgi.bundles= after the '=', insert the text
    org.eclipse.equinox.weaving.aspectj@2\:start,
4. save and start eclipse
Comment 1 Andrew Eisenberg CLA 2009-03-03 19:22:42 EST
Thanks for reporting this.  Just to get this in the bug report:

Option 1 does not work because you do not have PDE installed.

Option 2 did not work for you either.

Option 3 worked.  You had to add both lines to config.ini

This implies that the config.ini could not be found.

Did you notice any errors in the error log?

Shortly, I will publish a version of AJDT that provides more feedback when updating the config.ini fails.
Comment 2 Andrew Eisenberg CLA 2009-03-04 01:04:29 EST
What is the full path to the config.ini?

Is it writable?
Comment 3 Neale Upstone CLA 2009-03-09 10:31:41 EDT
I've had a look through my logs, and in .metadata's log I'm getting nothing useful, just:

!ENTRY org.eclipse.contribution.jdt 0 0 2009-02-27 17:39:04.885
!MESSAGE Weaving service successfully ENABLED
!SESSION 2009-02-27 17:39:09.338 -----------------------------------------------
eclipse.buildId=M20080911-1700
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Command-line arguments:  -os win32 -ws win32 -arch x86 -data C:\Dev\cat-all-eclipse-ide -clean

!ENTRY org.eclipse.contribution.jdt 0 0 2009-02-27 17:39:24.086
!MESSAGE Weaving service successfully ENABLED

!ENTRY org.eclipse.contribution.jdt 0 0 2009-02-27 17:53:40.315
!MESSAGE Weaving service successfully ENABLED




In my eclipse/configuration dir, the following is repeatedly logged and looks relevant:

!SESSION 2009-02-27 09:25:53.162 -----------------------------------------------
eclipse.buildId=M20080911-1700
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Command-line arguments:  -os win32 -ws win32 -arch x86 -clean

!ENTRY org.eclipse.equinox.simpleconfigurator 4 0 2009-02-27 09:25:54.256
!MESSAGE 
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.equinox.internal.simpleconfigurator.Activator.start() of bundle org.eclipse.equinox.simpleconfigurator.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1028)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:355)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1074)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:616)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:299)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.launch(StartLevelManager.java:247)
	at org.eclipse.osgi.framework.internal.core.SystemBundle.resume(SystemBundle.java:201)
	at org.eclipse.osgi.framework.internal.core.Framework.launch(Framework.java:644)
	at org.eclipse.osgi.framework.internal.core.OSGi.launch(OSGi.java:51)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:313)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Caused by: java.lang.IllegalStateException: The state indicates the bundle is resolved
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureMessage(AbstractBundle.java:1381)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:257)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:317)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:86)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:124)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:138)
	at org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:48)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	... 20 more
Root exception:
java.lang.IllegalStateException: The state indicates the bundle is resolved
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureMessage(AbstractBundle.java:1381)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:257)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:317)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:86)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:124)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:138)
	at org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:48)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:355)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1074)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:616)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:299)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.launch(StartLevelManager.java:247)
	at org.eclipse.osgi.framework.internal.core.SystemBundle.resume(SystemBundle.java:201)
	at org.eclipse.osgi.framework.internal.core.Framework.launch(Framework.java:644)
	at org.eclipse.osgi.framework.internal.core.OSGi.launch(OSGi.java:51)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:313)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

Comment 4 Andrew Eisenberg CLA 2009-03-09 19:49:43 EDT
Thanks Neale.  These are potentially some useful stack traces.  When I get back I will have a look.
Comment 5 Andrew Eisenberg CLA 2009-03-13 20:15:06 EDT
(In reply to comment #3)
Some things to notice here.

1. I notice that you run with -clean.  This may automatically disable the weaving.aspectj bundle on every restart.  This is because -clean resets the state of all bundles to the original (non-started) stae.

2. The stack trace that you sent me is from 3.4.1.  It seems that several of the stack frames have substantial changes for 3.4.2 (most notably BundleContextImpl).  I wonder if upgrading to 3.4.2 would help at all.

3. Looks like the exception is being thrown during startup, and not from AJDT code.

So, if you are still experiencing this problem can you try (in the following order):

1. removing the -clean option from start up and retrying
2. determining when the exception you posted occurs.  Does it happen during startup?  Does it happen every time during startup, or only when there is an attempt to enable the weaving service?  
3. upgrade to 3.4.2 and see if this fixes the problem.

Thank you for reporting this and I hope this helps us find the reason why you cannot automatically enable weaving.
Comment 6 Neale Upstone CLA 2009-03-30 05:33:57 EDT
Ok.  I think I may have got to the bottom of this.

There's a few things going on.

One is that in both 3.4 and 3.5 code streams, after an update of AJDT, I've had eclipse freeze before it starts writing anything to configuration/.log and before we see the progress bar on the eclipse splash screen.

Could this be that the weaving hook has changed datestamp, but the config.ini is out of date.

I've then launched eclipse using -clean.

I'm then asked to enable JDT weaving, and offered a restart.

The cycle repeats as described in this original bug report.

The reason is that the eclipse launcher is maintaining the -clean flag between restarts.

Ideally, I think that what is needed is:
- Weaving Hook update flags that it needs a -clean restart
- Eclipse launcher obliges and does a one-time-only -clean start
- JDT Weaving gets enabled
- Another (non-clean) restart then happens.

Ideally, the better approach would be if the enabling of JDT weaving could be done before the restart that the update manager prompts for.
Comment 8 Andrew Eisenberg CLA 2009-09-30 14:37:46 EDT
Move to the 2.0.2 release.
Comment 9 Andrew Eisenberg CLA 2009-12-15 23:14:02 EST
No more work to be done here.  Enbling weaving service is now much more robust.