Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321462

Summary: Cannot keep weaving service enabled after restart, shutdown error
Product: [Tools] AJDT Reporter: Matt R <MattRussellUK>
Component: UIAssignee: AJDT-inbox <AJDT-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrew.eisenberg
Version: 2.1.0   
Target Milestone: 2.1.1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Matt R CLA 2010-08-01 12:28:18 EDT
Build Identifier: I20100608-0911

Clean Eclipse 3.6 install on 32-bit Ubuntu 10.04, JDK 1.6.0_18. After I install AJDT from the 3.6 AJDT update site, when I go to Window->Preferences->JDT weaving, weaving is disabled. I can enable it, and it is noted in the error log:

eclipse.buildId=I20100608-0911
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_GB
Framework arguments:  -showlocation
Command-line arguments:  -os linux -ws gtk -arch x86 -showlocation -console

Weaving service successfully ENABLED
Info
Sun Aug 01 17:13:18 BST 2010
Information on currently installed bundles:org.eclipse.equinox.weaving.aspectj_1.0.0.v20100108 : ID 207: STATE ACTIVE
org.aspectj.weaver_1.6.10.20100715162300 : ID 196: STATE RESOLVED
com.springsource.org.aspectj.weaver not installed
org.eclipse.equinox.weaving.hook_1.0.0.v20100108 : ID 193: STATE RESOLVED

Then when I restart, I get a "shutdown error" in the Error log:

java.lang.IllegalStateException: The service has been unregistered
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:209)
at org.eclipse.osgi.framework.internal.core.ConsoleManager.stopConsole(ConsoleManager.java:162)
at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:412)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

After a restart, the weaving service is still disabled.

Reproducible: Always
Comment 1 Andrew Eisenberg CLA 2010-08-02 16:36:37 EDT
Your error on shutdown is preventing Eclipse to save its state and so therefore Eclipse is not remembering that Weaving should be enabled on the next startup.  I have not seen this shutdown error stack trace before and it doesn't include any weaving or AJDT code, so it could possibly be from a different plugin (but it is not out of the question that this is somehow coming from our code).

Regardless, it is possible to force weaving to be enabled in a different way.  The full description is here:

http://wiki.eclipse.org/JDT_weaving_features

But, simply put, you can do this:

0. Shut down eclipse
1. Open the file eclipse/configuration/config.ini in your favorite text editor/
2. Find the line that starts with: 
   osgi.bundles= 
and add after the '=': 
  org.eclipse.equinox.weaving.aspectj@2\:start,
3. Make sure there is a line that looks like (and if it is not there, then add it):
   osgi.framework.extensions=org.eclipse.equinox.weaving.hook
4. Start eclipse

Weaving should be active now.  If for some reason that doesn't work, read the rest of the page I provided above.  Please let me know if this works for you, and I can help you more if it doesn't.
Comment 2 Andrew Eisenberg CLA 2010-08-05 18:39:17 EDT
Any progress on this?
Comment 3 Matt R CLA 2010-08-08 12:56:55 EDT
(In reply to comment #2)
> Any progress on this?

Sorry to take a while to get back to you on this. Setting config.ini by hand fixed the problem -- cheers. Also, I get the shutdown error even on a clean install of 3.6, so it's definitely not the fault of AJDT.
Comment 4 Andrew Eisenberg CLA 2010-08-08 23:31:03 EDT
Thanks for getting back to me on this.  Glad that your problem is resolved.