Hi,
today after updating GeoServer I discovered the wcs111 unit tests were not working anymore. I was quite baffled at first, especially because
the stack trace (attached) it's long, but I think I figured out
what's going on.
In my configuration, things happen in this order:
* the Config object is loaded, this triggers the creation of
an XmlReader (and here we enter in the xml reader constructor)
* the xml reader constructor tries to load the catalog and config
files. At a certain point a coverage is read, and this requires
some wkt parsing, so CRS.parseWKT is called
* the referencing subsystem engages, and starts looking for
authorities in the SPI. The GeoServerFactoryIteratorProvider
has already been created and the SPI tries to use it to
find CRS authorities. The iterator calls GeoServerExtensions
* GeoServerExtension looks into the the spring context (whose
initialization is not complete) and apparently this results
in the wcs 111 service object being created. But this
requires the catalog, which in turn requires geoserver and...
* when GeoServer object is created, it assumes it's safe
to call config.getGeoserver() which in turns calls
reader.getGeoServer(), but the above reader is still not
assigned because it's still being created -> kaboom, NPE!
Now, the GeoServerFactoryIteratorProvider has been around
since November, but it has been registered only yesterday
by a Justin's commit.
I tried to poke at it but it seems no matter what I do
I end up creating a circular dependency.
Basically what I tried is to alter the following spring
definition:
<!-- extensions -->
<bean id="extensions" class="org.geoserver.platform.GeoServerExtensions" />
<!-- geotools factory iterator provider -->
<bean id="factoryIteratorProvider" depends-on="extensions"
class="org.geoserver.platform.GeoServerFactoryIteratorProvider"/>
so that either the iterator or the extensions depend on config
but I only get circular dependencies. What I was trying to do is
to ensure config is created before the iterator is created in
order to avoid the above problem... but I end up creating
another. I'll keep on working on this one trying to solve it,
but if you have any idea I'll all ears
Cheers
Andrea
(attachments)
stacktrace.txt (30.1 KB)