Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Buddy Classloader and jdbc drivers

This in convoluted. I'm going to start over with my instructions. I wasn't complete last night.

The postgis geotools plugin must be in libs or in the catalog.postgis plugin. If the postgis plugin is in libs the libs must export the postgis packages. That is what makes the postgis catalog plugin compile.

The jdbc drivers used by the geotools jar is in a separate plugin called net.refractions.udig.libs.postgis. This is a registered as a buddy with the plugin containing the geotools postgis jar. No packages need to be exported because the geotools jar is not a eclipse plugin. But the buddy registration adds the jdbc driver to the classpath used by the geotools postgis jar.

Questions?

Jesse

David Adler wrote:

Am I missing something? I don't see any Export-Package in the MANIFEST.MF that you created:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Postgis Plug-in
Bundle-SymbolicName: net.refractions.udig.libs.postgis
Bundle-Version: 1.0.0
Bundle-Vendor: Refractions Research Inc.
Bundle-Localization: plugin
Bundle-ClassPath: libs/postgis-driver-1.0.jar,
 libs/postgresql-74.213.jar
Eclipse-RegisterBuddy: net.refractions.udig.libs
Require-Bundle: net.refractions.udig.libs

At 12:44 PM 7/15/2005, you wrote:

Classloading in eclipse is definately a headache. The access restrictions you ran into are because the Manifest.MF allows you to specify which plugins are permitted to use certain packages. So in order for plugin B to access a package (and its files) in plugin A. Plugin A has to both:
1-Add the jar header in the Manifest.MF.
   Example: Bundle-ClassPath: libs/postgis-driver-1.0.jar
2-Add the packages that plugin B can access to the exported packages Header in the Manifest.MF.
   Example: Export-Package: org.postgis

It is a pain but once you know it it is really powerful.

Jesse

David Adler wrote:

Eclipse is making me crazy.

Although it is hard to believe that it is connected to this, after doing an svn update this morning I absolutely can not get things to work on my new Eclipse environment, It had been working fine with the libs.db2 fragment you added after I put in the DB2 JDBC jars but stopped this morning. I tried creating a plugin similar to the PostGIS plugin you added last night but this didn't work either (NoClassDef errors for JDBC classes). I also had strange problems with the catalog.db2 plugin saying that there were access restrictions with lib/db2-2.1.RC1.jar.

I will go back to my original development environment which still seems to work and not touch anything having to do with libraries, clean up all the informational messages and javadocs and check the code into svn.

Hopefully you will be able to talk sweetly to Eclipse in your environment to convince it to reference the right libraries and then I can rebuild everything from scratch in my environment.

At 10:18 PM 7/14/2005, you wrote:

I've just now been able to isolate the postgis jdbc driver in its own plugin using the "buddy classloader" system. I've checked it in as net.refractions.udig.libs.postgis. The things I had to do to make it work are:

1. Added Eclipse-BuddyPolicy: registered to the Manifest.MF in the net.refractions.udig.libs plugin. Now that it is added anyone can extend the classpath of libs. 2. In the Manifest of the net.refractions.udig.libs.postgis plugin I added the line: Eclipse-RegisterBuddy: net.refractions.udig.libs. This registers this plugin as a buddy of net.refractions.udig.libs. 3. Made net.refractions.udig.libs.postgis DEPEND on net.refractions.udig.libs. This got for for a long time. The dependency is required for some reason.

Jesse

Jody Garnett wrote:

I have been trying to isolate the postgis jdbc driver as either a fragment, or an lazy addition to libs via the "buddy classloader" system.
So far nothing has worked ...

What has worked is this:

net.refractions.udig.catalog.postgis/
net.refractions.udig.catalog.postgis/libs/
net.refractions.udig.catalog.postgis/libs/postgis-2.1.RC1.jar
net.refractions.udig.catalog.postgis/libs/postgis-driver-1.0.jar
net.refractions.udig.catalog.postgis/libs/postgresql-74.213.jar

That is moving the required geotools DataStore plugin (and its drives) into the net.refractions.udig.catalog.postgis plugin.

I am not happy with this solution for two reasons:
1) We are supposed to be able to "patch" libs with additional content, such as drivers 2) Libs has been set up to download the required jars from the maven repository, it would be a shape to lose this (or duplicate it).

Hopefully I can report back with some progress tomorrow.
Jody





_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net <http://udig.refractions.net/>
http://lists.refractions.net/mailman/listinfo/udig-devel




_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net <http://udig.refractions.net/>
http://lists.refractions.net/mailman/listinfo/udig-devel



_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net <http://udig.refractions.net/>
http://lists.refractions.net/mailman/listinfo/udig-devel

------------------------------------------------------------------------

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top