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

Bug 384873

Summary: org/eclipse/core/runtime/IPluginDescriptor is missing in runtime_registry_compatibility.jar
Product: [Eclipse Project] Platform Reporter: Andrey Loskutov <loskutov>
Component: RuntimeAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrea.ross, igor, john.arthorne, krzysztof.daniel, Lars.Vogel, pwebster, thanh.ha
Version: 1.0   
Target Milestone: 4.3 M5   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 385966    
Bug Blocks: 372792    
Attachments:
Description Flags
Patch none

Description Andrey Loskutov CLA 2012-07-11 16:52:12 EDT
Build Identifier: 

AS IS:
After starting Eclipse 3.8 built with the CBI I'm seeing "java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IPluginDescriptor" problems.

The reason: the .class file is NOT available in the runtime_registry_compatibility.jar from the org.eclipse.core.runtime.compatibility.registry_3.5.100.x directory!

All other classes from org.eclipse.core.runtime.compatibility.registry are there, except this one...

After copying the class into the jar file and restarting Eclipse the problem disappears.

TO BE:
IPluginDescriptor class file must be compiled into the runtime_registry_compatibility.jar

See original report: http://dev.eclipse.org/mhonarc/lists/cbi-dev/msg00493.html

Reproducible: Always
Comment 1 Krzysztof Daniel CLA 2012-07-19 07:46:55 EDT
I believe that the IPluginDescriptor.class is kept compiled in the project org.eclipse.core.runtime.compatibility.registry_3.5.100.x.:

./eclipse.platform.runtime/bundles/org.eclipse.core.runtime.compatibility.registry/classes/org/eclipse/core/runtime/IPluginDescriptor.class.

It is required only at build time.
Comment 2 Andrey Loskutov CLA 2012-07-19 08:33:22 EDT
(In reply to comment #1)
> It is required only at build time.

Even not. This class is required at run time, otherwise few plugins will have problems described here: http://dev.eclipse.org/mhonarc/lists/cbi-dev/msg00493.html.
Comment 3 Andrea Ross CLA 2012-07-24 16:57:14 EDT
Paul, do you know where this comes from?
Comment 4 Paul Webster CLA 2012-07-25 08:34:37 EDT
org/eclipse/core/runtime/IPluginDescriptor is in org.eclipse.core.runtime in the source.

In org.eclipse.core.runtime.compatibility.registry it's in a classes subfolder, and it looks like customBuildCallbacks.xml adds those classes.

PW
Comment 5 Paul Webster CLA 2012-07-25 08:36:46 EDT
John might be able to shed some light on what's supposed to be going on.

PW
Comment 6 John Arthorne CLA 2012-07-25 11:27:17 EDT
I can see from the history the custome callback was added in bug 329277. I believe the reason here is that the stuff in the classes folder was compiled against the old pre-Eclipse 3.0 API which was later refactored. This needs to be folded into the compatibility.registry bundle to enable the old Eclipse 2.x API to function. 

I am somewhat surprised that the error surfaces when running the Eclipse SDK, because it implies we still have dependencies on this 2.x-3.0 compatibility layer. Or did you install additional bundles Andrey?
Comment 7 Andrey Loskutov CLA 2012-07-25 11:32:04 EDT
(In reply to comment #6)
> I am somewhat surprised that the error surfaces when running the Eclipse SDK,
> because it implies we still have dependencies on this 2.x-3.0 compatibility
> layer. Or did you install additional bundles Andrey?

For sure :-) It was Clearcase plugin from IBM :-)
Comment 8 John Arthorne CLA 2012-07-25 11:36:06 EDT
That explains it! So what we need to know is the Tycho way to include both the content from src and the content from classes folder in the final jar.
Comment 9 Igor Fedorenko CLA 2012-07-30 16:30:13 EDT
Well, as somebody commented on one of the bugs I reported against PDE many years ago, "nested jars are evil" (https://bugs.eclipse.org/bugs/show_bug.cgi?id=111238#c11), so to discourage their use Tycho makes nested jars little extra hard to produce :-)

Seriously, though, to include IPluginDescriptor.class in runtime_registry_compatibility.jar, add the following snippet to org.eclipse.core.runtime.compatibility.registry/pom.xml. It tells Maven to copy all files from classes/ folder to target/classes directory, which happens to be what is included in runtime_registry_compatibility.jar. Kinda hackish, but works.

  <build>
    <resources>
      <resource>
        <directory>classes</directory>
      </resource>
    </resources>
  </build>
Comment 10 Krzysztof Daniel CLA 2012-08-13 08:57:13 EDT
(In reply to comment #9)
Is it possible to get IPluginDescriptor from the org.eclipse.core.runtime bundle in any other way than using maven-ant-runner ?
Comment 11 Igor Fedorenko CLA 2012-08-13 09:05:05 EDT
I am not sure what you mean. IPluginDescriptor.class file is part of org.eclipse.core.runtime.compatibility.registry project source tree. It needs to be included in runtime_registry_compatibility.jar and the pom.xml snippet I showed in comment #9 does that without ant. Where else do you need to "get" the class to?
Comment 12 Krzysztof Daniel CLA 2012-08-21 10:16:54 EDT
Not "to". "from". I can't use *.class in Fedora, so I need to get it from the project where it is really compiled...
Comment 13 Igor Fedorenko CLA 2012-08-21 11:09:48 EDT
I am not sure it is possible to compile IPluginDescriptor as part of the current Eclipse source tree, but I would let somebody from Eclipse Platform team comment on this.
Comment 14 Krzysztof Daniel CLA 2012-08-23 08:19:06 EDT
Created attachment 220197 [details]
Patch

This is a copy of the patch that I'm using to get the IPluginDescriptor into right location.
Comment 15 John Arthorne CLA 2012-08-23 13:29:58 EDT
The IPluginDescriptor class file in the source tree was compiled against an older version of the Eclipse platform API, so it would be difficult (and unnecessary) to compile this in the CBI build. How did the old Fedora build handle this?
Comment 16 Krzysztof Daniel CLA 2012-08-24 03:24:49 EDT
(In reply to comment #15)
In the same way. Copied a class file. But I see now it was wrong - since it should be an older version. I need to find a better solution for that.
Comment 17 Krzysztof Daniel CLA 2012-11-21 07:23:26 EST
I have tried to use the approach described in comment 9 but it does not work for me - the class file is not copied.

Thanh, Andrew,
I think a fix for this issue should go into CBI 1.0 :-), so may I ask for double verification of the proposed solution (I mean - I have somewhat modified build environment and I may be doing somethign wrong...).
Comment 18 Thanh Ha CLA 2012-11-21 16:11:09 EST
(In reply to comment #17)
> I have tried to use the approach described in comment 9 but it does not work
> for me - the class file is not copied.
> 
> Thanh, Andrew,
> I think a fix for this issue should go into CBI 1.0 :-), so may I ask for
> double verification of the proposed solution (I mean - I have somewhat
> modified build environment and I may be doing somethign wrong...).

Hi Krzysztof, I tried Igor's suggestion from comment 9 and it seems to have copied over the IPluginDescriptor.class file to target/classes for me.

$ ls target/classes/org/eclipse/core/runtime/IPluginDescriptor.class
target/classes/org/eclipse/core/runtime/IPluginDescriptor.class


I also noticed in my log when the maven-resources-plugin is run I get the following output:


[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ org.eclipse.core.runtime.compatibility.registry ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource


I'm assuming the 1 resource is the IPluginDescriptor.class.


Is there any additional patches I should apply to run to reproduce your issue?
(I did not apply the patch that's attached to this bug, should I?)
Comment 19 Krzysztof Daniel CLA 2012-11-22 02:25:22 EST
Thanks, Thanh!

If this works for you, then there is a bug in my environment and I need to fix it by myself. It's ok to apply just Igor suggestion from comment 9.
Comment 21 Thanh Ha CLA 2013-01-10 14:54:08 EST
(In reply to comment #20)
> master:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/
> ?id=f051f1bd355bc6e186b0a8d1bbf37888d157b5f7
> 
> R4_2_maintenance:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/
> ?h=R4_2_maintenance&id=9ce2e2da476d8b13914da5c1fa1d6824e78b6583

I can confirm that this file IPluginDescriptor.class is now included in the runtime_registry_compatibility.jar that is produced in the CBI build.


Archive:  runtime_registry_compatibility.jar
   creating: org/
   creating: org/eclipse/
   creating: org/eclipse/core/
   creating: org/eclipse/core/internal/
   creating: org/eclipse/core/internal/registry/
   creating: org/eclipse/core/runtime/
  inflating: org/eclipse/core/internal/registry/RegistryCompatibilityHelper.class  
  inflating: org/eclipse/core/internal/registry/ExtensionHandle.class  
  inflating: org/eclipse/core/internal/registry/ExtensionPointHandle.class  
  inflating: org/eclipse/core/internal/registry/BundleHelper.class  
  inflating: org/eclipse/core/runtime/IExtension.class  
  inflating: org/eclipse/core/runtime/IPluginDescriptor.class  
  inflating: org/eclipse/core/runtime/IExtensionPoint.class
Comment 22 John Arthorne CLA 2013-01-25 10:05:44 EST
Thanks Thanh. Marking fixed.