[geotk] NullPointerException attempting to create a WFS Client

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Fri Sep 5 03:22:39 PDT 2014


Hello Bret

I just tried the code snippet you provided and didn't got the
NullPointerException. Maybe we are not testing in the same environment.
Was the code executed in Tomcat or some other application container?
(I'm suspecting a ClassLoader issue).

I also noticed that your stack trace reports the NullPointerException at
line 313, while I would have expected line 277 with the current source
code. Does the IndexedResourceBundle class has local changes, or was the
SIS code fetched from an other repository than
http://svn.apache.org/repos/asf/sis or http://github.com/apache/sis ?

    Martin


Le 05/09/14 01:26, Bret Frederick a écrit :
> 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/20140905/cb81f46f/attachment-0001.html>


More information about the Geotoolkit mailing list