Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349175 - [hotbug] 3rd party ResourceLocator implementations can not be loaded
Summary: [hotbug] 3rd party ResourceLocator implementations can not be loaded
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P1 major (vote)
Target Milestone: 3.0.1   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-13 06:26 EDT by Fred Bricon CLA
Modified: 2011-07-27 15:06 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
patch (1015 bytes, patch)
2011-06-13 12:35 EDT, Paul Fullbright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Bricon CLA 2011-06-13 06:26:57 EDT
Build Identifier: I20110526-1708

I've been trying to provide an implementation of IResourceLoader for maven projects (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=251323 and https://issues.sonatype.org/browse/MECLIPSEWTP-11)

The fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=317900 however doesn't find my custom resource loader :

!MESSAGE Unable to load the class 'org.maven.ide.eclipse.wtp.jpt.MavenResourceLocator' declared for the extension point 'org.eclipse.jpt.common.core.resourceLocators' in the plug-in 'org.eclipse.jpt.common.core'.
!STACK 0
java.lang.ClassNotFoundException: org.maven.ide.eclipse.wtp.jpt.MavenResourceLocator
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    at org.eclipse.jpt.common.core.internal.utility.XPointTools.loadClass(XPointTools.java:61)
    at org.eclipse.jpt.common.core.internal.utility.XPointTools.instantiate(XPointTools.java:37)
    at org.eclipse.jpt.common.core.internal.resource.ResourceLocatorConfig.getResourceLocator(ResourceLocatorConfig.java:81)


Looking at

    public ResourceLocator getResourceLocator() {
        return XPointTools.instantiate(
                JptCommonCorePlugin.PLUGIN_ID, ResourceLocatorManager.QUALIFIED_EXTENSION_POINT_ID, 
                this.className, ResourceLocator.class);
    }


And in XPointTools  :

        Bundle bundle = Platform.getBundle(pluginId);
        Class<?> clazz;
        try {
            clazz = bundle.loadClass(className);
        } catch (Exception ex) {
            logFailedClassLoad(ex, pluginId, extensionPoint, className);
            return null;
        }

Seems to me the classes are only searched in the common plugin classloader.

According to Max R. Andersen, the pluginId used for the look up should be more like : element.getDeclaringExtension().getContributor().getName() instead of JptCommonCorePlugin.PLUGIN_ID

Actually, createExecutableExtension() should be used http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/IConfigurationElement.html

Fixing this ASAP would - hopefully - allow me to provide a fix for #251323, by the time Indigo is released.


Reproducible: Always
Comment 1 Fred Bricon CLA 2011-06-13 06:29:57 EDT
humm read ResourceLocator, not IResourceLoader
Comment 2 Max Rydahl Andersen CLA 2011-06-13 06:44:05 EDT
We would like to mark this as a hotbug since it prevents good Maven/Dali integration.

Affiliation: Red Hat, project: JBoss Tools, product: JBoss Developer Studio

Release to be fixed in: Indigo ASAP

Justification: This is a hotbug since Dali have made the effort to implement custom resourcelookup for their artifacts but it is not possible to implement them unless you are on the classpath of the Dali plugins - i.e., its not possible for 3rd party plugins such as m2ewtp to implement it.

This blocks adoption of Dali + Maven with Eclipse WTP since otherwise the user experience will suffer because of impedance mismatch of where resources are located/edited.
Comment 3 Paul Fullbright CLA 2011-06-13 12:35:54 EDT
Created attachment 197901 [details]
patch

Can you verify that this fixes your problem?
Comment 4 Fred Bricon CLA 2011-06-13 13:01:08 EDT
(In reply to comment #3)
> Created attachment 197901 [details]
> patch
> 
> Can you verify that this fixes your problem?

I will try as soon as I can. I currently don't have the Dali source projects checked out. Need to find some instructions for setup first
Comment 5 Neil Hauge CLA 2011-06-13 13:22:58 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > Created attachment 197901 [details] [details]
> > patch
> > 
> > Can you verify that this fixes your problem?
> 
> I will try as soon as I can. I currently don't have the Dali source projects
> checked out. Need to find some instructions for setup first

This should help you get started - http://wiki.eclipse.org/Dali_Developer_Documentation
Comment 6 Paul Fullbright CLA 2011-06-23 12:41:20 EDT
Any word?  We're adding this patch to our post 3.0 code stream.
Comment 7 Fred Bricon CLA 2011-06-23 12:44:22 EDT
(In reply to comment #6)
> Any word?  We're adding this patch to our post 3.0 code stream.

Sorry, but I've been swamped and couldn't give it a try. Will try next week.
Comment 8 Paul Fullbright CLA 2011-06-23 13:52:06 EDT
patch committed post 3.0.  Waiting for extender feedback.
Comment 9 Fred Bricon CLA 2011-07-27 13:50:20 EDT
X weeks later, I confirm this is fixed in trunk. It was able to call my class.
Sorry for the late reply guys.

Now I have to figure out how I'm supposed to implement that locator correctly, but that's another story :-)
Comment 10 Paul Fullbright CLA 2011-07-27 15:06:13 EDT
Marking as fixed.


Fred, feel free to visit and or post any questions at the Dali forum.  It's pretty well monitored.

http://www.eclipse.org/forums/index.php/f/113/