Justin is correct - the GeoTools "lookup and intergration" code is broken.
Indeed I am talking with Martin right now about a couple proposed fixes :-( For now you are stuck dumping eveything into a single plugin (or many buddy plugins) so they all get in the same class loader. At a technical level our "Factory Lookup" is done in the same manner as ImageIO ... it goes into each jar looking for a directory "META-INF/services/" where have a file named after the interface being discovered. The file lists all the instances that the jar provides. The OSGi classloader is EVIL and locks down the packages that can be loaded by dependent plugins (they chain class loaders so a dependent plugin is loaded using a child classloader). However you have to list manually the packages that are visible - and they don't let you list "META-INF/services/" (as it is not a valid package name). So the that file is not available as a resource :-( The proposed solution is to register a FactoryIterator with GeoTools; and then implement one that plugin extension point (so yes we will need to duplicate all the information contained in META-INF/services). Cheers, Jody Justin Deoliveira wrote: > Hi Gary, > > Yes the breakdown geotools modules wont map cleanly to eclipse rcp > plugins due to class loading issues. I believe there is some magic you > can pull off with "buddy classloading" but I have never tried it out. > The udig guys can comment on that. > > The udig approach is to have a single "libs" plugin which essentially > contains the entire geotools library in one plugin. What is your plugin > structure? > > -Justin > > Gary Lucas wrote: > >> I am attempting to use GeoTools to create and eclipse plug-in that draws >> maps. I've had some luck writing conventional Java applications and >> decided to move forward a Rich Client Platform (RCP) implementation to >> take advantage of the better GUI support. Anyway, I've hit a roadblock. >> >> At the point in the program execution when I try to create my first map, >> the program fails when calling a constructor for a class. The class >> loads a shape file and creates a map context. A key point here is that >> the constructor itself is empty (it's just a stub for now) and the >> method that creates the map context is NEVER called. Even so, if the >> statement >> >> MapContext mapContext = DefaultMapContext(); >> >> is called, the program fails. If the line is commented out, it continues >> on... though of course there's little point in doing so since it will >> never be able to render a map. A similar thing happens if I use >> DefaultMapLayer. Interestingly enough, the program is able to include >> code open a shape file and create a ShapeFileDatastore. >> >> Clearly the problem has to do with the ClassLoader and Eclipse's notion >> of installing custom class loaders. I am new to the RCP and plug-ins, >> so I don't really know how to proceed from here. >> >> I was wondering whether anyone had a solution for this problem. I know >> that the uDig folks must have worked it out, but I haven't found any >> relevant discussion in the archives for this mailing list. >> >> As I have said so many times before on this discussion group: thanks in >> advance for your help. >> >> Gary >> >> >> >> >> >> >> >> >> --- >> Gary W. Lucas, Senior Software Engineer >> Sonalysts, Inc >> 215 Parkway North >> Waterford, CT 06320 >> (860) 326-3682 >> >> >> >> !DSPAM:4007,45fa8ed8230332051017194! >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> >> !DSPAM:4007,45fa8ed8230332051017194! >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Geotools-gt2-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> >> !DSPAM:4007,45fa8ed8230332051017194! >> > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
