[geotk] NullPointerException attempting to create a WFS Client

Bret Frederick bret.frederick at patvmackinc.com
Thu Sep 4 16:26:37 PDT 2014


Hello,

Hopefully this is the right forum, although the error I’m seeing is coming from the SIS lib.

I’m attempting to create a basic WFS client application using GeoToolkit and have run into this problem.  Please excuse the lengthy post, but I wanted to provide complete information.

...
	final MyClientSecurity security = new MyClientSecurity(); //extends DefaultClientSecurity

        final WFSFeatureStoreFactory wfsFeatureStoreFactory = new WFSFeatureStoreFactory();
        final Map params = new java.util.HashMap();
        final URL url = new URL(
                        "https://my.wfs.service/wfsaccess?service=wfs");
        params.put("url", url);
        params.put("security", security); //version not set as I understand it defaults to 1.1.0
       
	WebFeatureClient client = wfsFeatureStoreFactory.open(params);

       final String[] typeNames = client.getTypeNames();
...


When I try to create an instance of WFSFeatureStoreFactory, it throws this stack trace

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.geotoolkit.feature.FeatureFactory.<clinit>(FeatureFactory.java:65)
	at org.geotoolkit.feature.FeatureUtilities.<clinit>(FeatureUtilities.java:59)
	at org.geotoolkit.data.AbstractFeatureStoreFactory.open(AbstractFeatureStoreFactory.java:105)
	at org.geotoolkit.data.wfs.WFSFeatureStoreFactory.open(WFSFeatureStoreFactory.java:129)
	at com.pvm.gtktest.AppTest.test2(AppTest.java:58)
	at com.pvm.gtktest.AppTest.main(AppTest.java:91)
Caused by: java.lang.NullPointerException
	at org.apache.sis.util.resources.IndexedResourceBundle.ensureLoaded(IndexedResourceBundle.java:313)
	at org.apache.sis.util.resources.IndexedResourceBundle.ensureLoaded(IndexedResourceBundle.java:313)
	at org.apache.sis.util.resources.IndexedResourceBundle.ensureLoaded(IndexedResourceBundle.java:313)
	at org.apache.sis.util.resources.IndexedResourceBundle.handleGetObject(IndexedResourceBundle.java:398)
	at java.util.ResourceBundle.getObject(ResourceBundle.java:389)
	at java.util.ResourceBundle.getString(ResourceBundle.java:355)
	at org.apache.sis.util.resources.IndexedResourceBundle.getString(IndexedResourceBundle.java:523)
	at org.apache.sis.util.resources.IndexedResourceBundle.getString(IndexedResourceBundle.java:555)
	at org.geotoolkit.factory.FactoryRegistry.getLogHeader(FactoryRegistry.java:980)
	at org.geotoolkit.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:794)
	at org.geotoolkit.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:850)
	at org.geotoolkit.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:273)
	at org.geotoolkit.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:527)
	at org.geotoolkit.factory.DynamicFactoryRegistry.getServiceImplementation(DynamicFactoryRegistry.java:312)
	at org.geotoolkit.factory.FactoryRegistry.getOrCreateServiceProvider(FactoryRegistry.java:434)
	at org.geotoolkit.factory.DynamicFactoryRegistry.getOrCreateServiceProvider(DynamicFactoryRegistry.java:168)
	at org.geotoolkit.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:311)
	at org.geotoolkit.factory.FactoryFinder.getFactory(FactoryFinder.java:240)
	at org.geotoolkit.factory.FactoryFinder.getFilterFactory(FactoryFinder.java:670)
	at org.geotoolkit.feature.AbstractFeatureFactory.<clinit>(AbstractFeatureFactory.java:51)


The stack points to line 313 of IndexedResourceBundle class which has a comment…
// If we get a NullPointerException or
// ClassCastException here,
// it would be a bug in the way we create the chain of
// parents.

Is this a bug?  If so, how can I work around it?  If not, what am I doing wrong?

Also, I’m building from source code using the JDK7 branch of Apache SIS, and the latest source from GeoToolkit, but have the same problem if I just use binary packages.
I’m also using locale en_US

Thanks in advance for any advice you can provide

Cheers,
Bret

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20140904/90765c52/attachment.html>


More information about the Geotoolkit mailing list