GeoTools
  1. GeoTools
  2. GEOT-2984

Problem using WFS client in multi-classloader environment (fix attached)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.1, 2.6.2
    • Fix Version/s: 2.6.4, 2.7-M0
    • Component/s: wfs plugin
    • Labels:
      None
    • Environment:
      Apache Felix 4.0.2

      Description

      I had to fix what I believe to be a bug in the WFS client to get it working under OSGI (Apache Felix 2.0.4), and I wanted to share what I found ...

      I had to change the way that org.geotools.data.wfs.protocol.wfs.WFSExtensions looks up the WFSResponseParserFactory service. Currently, the code is going straight to the javax.imageio.spi.ServiceRegistry. Looking around the code, however, it seemed that other places were using the org.geotools.factory.FactoryCreator class, which is a bit more clever when it comes to mulit-classloader environments (such as OSGI). I modified the core logic into the getServiceProviders method to the following:

      FactoryRegistry factReg = new FactoryCreator( new Class[]

      {WFSResponseParserFactory.class}

      );
      factReg.scanForPlugins();
      Iterator<WFSResponseParserFactory> providers = factReg.getServiceProviders(WFSResponseParserFactory.class, true);
      registry = new HashSet<WFSResponseParserFactory>();
      while (providers.hasNext())

      { WFSResponseParserFactory provider = providers.next(); registry.add(provider); }

      This seems to solve the problem. I've attached the WFSExtensions.java file with my modifications. This is a change made against geotools 2.6.1, although looking in svn 2.6.2 has the same problem.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Gabriel Roldan
            Reporter:
            Nathan Mittler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: