views:

506

answers:

2

I'm trying to use a relatively new Eclipse plug-in (http://uqbar-tomcat-xt.sourceforge.net/download.html). It doesn't have an update site, so I can't install it through the UI in Eclipse, which usually resolves dependencies. All that's available for download is a single .jar, and the instructions on the website say to just drop it in eclipse/plugins. When I do that, it seems to work, in the sense that I get the new options in Window -> Show View that the plug-in should add. However, when I try to use either of those views, I get the following error:

org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.uqbar.eclipse.tomcat.xt (304).
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:125)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
...snip...
Caused by: org.osgi.framework.BundleException: The activator org.uqbar.eclipse.tomcat.xt.UqbarSydeoXtActivator for bundle org.uqbar.eclipse.tomcat.xt is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:157)
...snip...
Caused by: java.lang.Error: Unresolved compilation problems: 
    The import com.thoughtworks cannot be resolved
    XStream cannot be resolved to a type
    XStream cannot be resolved to a type
    XStream cannot be resolved to a type

The dependencies page of the above site lists several dependencies, including XStream. I tried downloading those .jars separately and dropping them into the eclipse/plugins directory as well, but that didn't resolve the error. When I look at the manifest in the jar, I see:

Bundle-ClassPath: .,commons-logging-1.0.4.jar,xpp3_min-1.1.4c.jar,xstr
 eam-1.3.jar,xstream-benchmark-1.3.jar

But obviously the xstream jars aren't available on the classpath (which is where?). I'm not sure where I can put them so that they're recognized by the plug-in.

I've tried contacting the developers and got no response, so I'm turning to SO. Is there anything I can do, or is the plug-in packaged incorrectly?

Update: Apparently the error is in the Activator, not the plugin itself. I tried importing the plugin as a source project, but the src/ directory is empty. The plugin doesn't appear in the list of available deployable plugins when I try to export it. So this is still unsolved.

+2  A: 

You can define an Eclipse fragment with the missing dependency on its classpath (normally in the lib directory of the fragment and specified on the classpath in the manifest).

A fragment is a special type of plugin that is attached to a target plugin. The fragment is merged with the target plugin at runtime, so the classes in the plugin will have access to the jar.

See this question for some pointers on creating a fragment.

Rich Seller
Hm, I tried this but I'm still getting the same error. It seems to be a compile-time problem, and since fragments get logically merged at run-time it didn't solve the issue. Would I need to get the plugin source and recompile myself? Is there anything I can do to fix this, given that the source isn't available? Still waiting to hear from the developers who made it.
Kelly Ellis
+1  A: 

Rich Seller's fix will work, though the real problem is a crappy plug-in which specifies a bunch of 3rd-party libraries on the Bundle-ClassPath, but doesn't actually include them! The Bundle-ClassPath is the classpath internal to the bundle, so any referenced libraries should be inside the bundle.

Since the source code is included, you could re-build the plug-in with the missing dependencies (license allowing), though I think all of those third-party dependencies should be external - but that's an entirely different discussion about how to write OSGi bundles/Eclipse plug-ins.

hbunny
Unfortunately the source code isn't included. All they've released is a .jar.
Kelly Ellis
The source code was in the JAR I downloaded to have a look.
hbunny