title: Eclipse RCP classloading problem with Metro
body: <p>I am attempting to invoke a web service using the <a href="http://metro.java.net/" rel="nofollow noreferrer">Metro library</a> from within an Eclipse RCP application. I bundled the relevant Metro jars (<code>webservices-tools.jar</code>, <code>webservices-rt.jar</code>, and <code>webservices-api.jar</code>) into a plugin and made my main application plugin depend on this new Metro plugin.</p>
  
  <p>I also added the <code>webservices-api.jar</code> to my <code>$JAVA_HOME/jre/lib/endorsed</code> directory. According to the Metro website, this is required when using Metro with Java 1.6.</p>
  
  <p>Now when I invoke any web service, I get the following error:</p>
  
  <pre><code>javax.xml.ws.WebServiceException: Provider com.sun.xml.ws.spi.ProviderImpl not found
  at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.jav a:38)
  at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:133)
  at javax.xml.ws.spi.Provider.provider(Provider.java:83)
  at javax.xml.ws.Service.&lt;init&gt;(Service.java:56)  
  ...  
  Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.spi.ProviderImpl
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301 )
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:129)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.jav a:34)
  ... 43 more
  </code></pre>
  
  <p>The class <code>com.sun.xml.ws.spi.ProviderImpl</code> resides in <code>webservices-rt.jar</code>, which is a part of my Metro plugin. Furthermore, I have verified that my application plugin code can successfully load this class, so I'm not sure why <code>javax.xml.ws.spi.FactoryFinder</code> can't.</p>
  
  <p>Since <code>javax.xml.ws.spi.FactoryFinder</code> resides in <code>webservices-api.jar</code> (the jar I had to put in the jre's endorsed directory), I suspect that this has something to do with endorsed code not being able to load classes from an Eclipse plugin.</p>
  
  <p>Is it the case that code loaded by the JVM from the endorsed directory cannot load classes from plugins? Is there any way to enable this?</p>
  
  <p>Java version: 1.6.0_16</p>
  
  <p>Eclipse version: Eclipse Java EE IDE for Web Developers Build id: 20090920-1017 (it doesn't display a version beyond that)</p>
  
  <p>Metro version: Bundled with Glassfish 2.1</p>
  
  <p>Any help is greatly appreciated. Thanks.</p>