"PropertyDescriptor is null - did you request a property that does not exist?" ... But it does!

3 messages Options
Embed this post
Permalink
Julian Hagenauer

"PropertyDescriptor is null - did you request a property that does not exist?" ... But it does!

Reply Threaded More More options
Print post
Permalink
Hi,
sorry for spaming the list with my problems, but after fiddling some hours with my code, i made no further progress myself solving the problem.
So, this is my code:

URL url = new URL("http://localhost/geoserver/wfs?request=getCapabilities&srs=EPSG:4326");
Map<String, Serializable> m = new HashMap<String, Serializable>();
m.put(WFSDataStoreFactory.URL.key, url);
m.put(WFSDataStoreFactory.TIMEOUT.key, 30000);
m.put(WFSDataStoreFactory.MAXFEATURES.key, 10);

DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);
Query query = new DefaultQuery(wfs.getTypeNames()[i], bbox, new String[] "osm_id","name"} );
FeatureReader ft = wfs.getFeatureReader(query, Transaction.AUTO_COMMIT);

I am trying to access my WFS, explicitly requesting only the ids and names of the features.

This is what java gave me back:
03.09.2009 09:46:02 org.geotools.data.wfs.WFSDataStoreFactory determineCorrectStrategy
INFO: Using WFS Strategy: org.geotools.data.wfs.v1_1_0.GeoServerStrategy
03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: results[ class java.lang.String ] is not of type class net.opengis.wfs.ResultTypeType
03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/ows}ServiceType does not declare a target type
03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/wfs}Base_TypeNameListType does not declare a target type
03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor visit
WARNUNG: Binding: {http://www.opengis.net/wfs}TypeNameListType does not declare a target type
DecribeFT URL for osm_auto:points: http://localhost/geoserver/wfs?=&TYPENAME=osm_auto%3Apoints&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28osm_auto%3Dhttp%3A%2F%2Ffoo_domain%2Fkarto%2Fosm_auto%29&
java.lang.NullPointerException: PropertyDescriptor is null - did you request a property that does not exist?
        at org.geotools.feature.type.ComplexTypeImpl.<init>(ComplexTypeImpl.java:71)
        at org.geotools.feature.type.FeatureTypeImpl.<init>(FeatureTypeImpl.java:50)
        at org.geotools.feature.simple.SimpleFeatureTypeImpl.<init>(SimpleFeatureTypeImpl.java:55)
        at org.geotools.feature.type.FeatureTypeFactoryImpl.createSimpleFeatureType(FeatureTypeFactoryImpl.java:154)
        at org.geotools.feature.simple.SimpleFeatureTypeBuilder.buildFeatureType(SimpleFeatureTypeBuilder.java:850)
        at org.geotools.data.DataUtilities.createSubType(DataUtilities.java:1303)
        at org.geotools.data.wfs.v1_1_0.parsers.FeatureCollectionParser.parse(FeatureCollectionParser.java:65)
        at org.geotools.data.wfs.protocol.wfs.WFSExtensions.process(WFSExtensions.java:75)
        at org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getFeatureReader(WFS_1_1_0_DataStore.java:325)
        at myprog.loadFeaturesFromWFS(MyProg.java:94)

So, basically it says, that there is no property called name. I sniffed the network traffic and this is the schema, that is returend to geotools during the request:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:osm_auto="http://foo_domain/karto/osm_auto" elementFormDefault="qualified" targetNamespace="http://foo_domain/karto/osm_auto">
  <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:80/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
  <xsd:complexType name="pointsType">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="0" name="osm_id" nillable="true" type="xsd:int"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="type" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="public_tran" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="amenity" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="shop" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="tourism" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:PointPropertyType"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="points" substitutionGroup="gml:_Feature" type="osm_auto:pointsType"/>
</xsd:schema>

So, the schema does explicity state that there is a property called "name". Any idea whats wrong?

Thank you very much,
Julian

--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: "PropertyDescriptor is null - did you request a property that does not exist?" ... But it does!

Reply Threaded More More options
Print post
Permalink
Try changing your URL to have "&VERSION=1.0".
Jody

On 03/09/2009, at 6:10 PM, Julian Hagenauer wrote:

> Hi,
> sorry for spaming the list with my problems, but after fiddling some  
> hours with my code, i made no further progress myself solving the  
> problem.
> So, this is my code:
>
> URL url = new URL("http://localhost/geoserver/wfs?request=getCapabilities&srs=EPSG:4326 
> ");
> Map<String, Serializable> m = new HashMap<String, Serializable>();
> m.put(WFSDataStoreFactory.URL.key, url);
> m.put(WFSDataStoreFactory.TIMEOUT.key, 30000);
> m.put(WFSDataStoreFactory.MAXFEATURES.key, 10);
>
> DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);
> Query query = new DefaultQuery(wfs.getTypeNames()[i], bbox, new  
> String[] "osm_id","name"} );
> FeatureReader ft = wfs.getFeatureReader(query,  
> Transaction.AUTO_COMMIT);
>
> I am trying to access my WFS, explicitly requesting only the ids and  
> names of the features.
>
> This is what java gave me back:
> 03.09.2009 09:46:02 org.geotools.data.wfs.WFSDataStoreFactory  
> determineCorrectStrategy
> INFO: Using WFS Strategy:  
> org.geotools.data.wfs.v1_1_0.GeoServerStrategy
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> visit
> WARNUNG: results[ class java.lang.String ] is not of type class  
> net.opengis.wfs.ResultTypeType
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> visit
> WARNUNG: Binding: {http://www.opengis.net/ows}ServiceType does not  
> declare a target type
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> visit
> WARNUNG: Binding: {http://www.opengis.net/wfs}Base_TypeNameListType  
> does not declare a target type
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> visit
> WARNUNG: Binding: {http://www.opengis.net/wfs}TypeNameListType does  
> not declare a target type
> DecribeFT URL for osm_auto:points: http://localhost/geoserver/wfs?=&TYPENAME=osm_auto%3Apoints&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28osm_auto%3Dhttp%3A%2F%2Ffoo_domain%2Fkarto%2Fosm_auto%29&
> java.lang.NullPointerException: PropertyDescriptor is null - did you  
> request a property that does not exist?
> at org.geotools.feature.type.ComplexTypeImpl.<init>
> (ComplexTypeImpl.java:71)
> at org.geotools.feature.type.FeatureTypeImpl.<init>
> (FeatureTypeImpl.java:50)
> at org.geotools.feature.simple.SimpleFeatureTypeImpl.<init>
> (SimpleFeatureTypeImpl.java:55)
> at  
> org.geotools.feature.type.FeatureTypeFactoryImpl.createSimpleFeatureType
> (FeatureTypeFactoryImpl.java:154)
> at  
> org.geotools.feature.simple.SimpleFeatureTypeBuilder.buildFeatureType
> (SimpleFeatureTypeBuilder.java:850)
> at org.geotools.data.DataUtilities.createSubType(DataUtilities.java:
> 1303)
> at  
> org.geotools.data.wfs.v1_1_0.parsers.FeatureCollectionParser.parse
> (FeatureCollectionParser.java:65)
> at org.geotools.data.wfs.protocol.wfs.WFSExtensions.process
> (WFSExtensions.java:75)
> at org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getFeatureReader
> (WFS_1_1_0_DataStore.java:325)
> at myprog.loadFeaturesFromWFS(MyProg.java:94)
>
> So, basically it says, that there is no property called name. I  
> sniffed the network traffic and this is the schema, that is returend  
> to geotools during the request:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml 
> " xmlns:osm_auto="http://foo_domain/karto/osm_auto"  
> elementFormDefault="qualified" targetNamespace="http://foo_domain/karto/osm_auto 
> ">
>  <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:80/geoserver/schemas/gml/3.1.1/base/gml.xsd 
> "/>
>  <xsd:complexType name="pointsType">
>    <xsd:complexContent>
>      <xsd:extension base="gml:AbstractFeatureType">
>        <xsd:sequence>
>          <xsd:element maxOccurs="1" minOccurs="0" name="osm_id"  
> nillable="true" type="xsd:int"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="name"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="type"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="public_tran"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="amenity"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="shop"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="tourism"  
> nillable="true" type="xsd:string"/>
>          <xsd:element maxOccurs="1" minOccurs="0" name="the_geom"  
> nillable="true" type="gml:PointPropertyType"/>
>        </xsd:sequence>
>      </xsd:extension>
>    </xsd:complexContent>
>  </xsd:complexType>
>  <xsd:element name="points" substitutionGroup="gml:_Feature"  
> type="osm_auto:pointsType"/>
> </xsd:schema>
>
> So, the schema does explicity state that there is a property called  
> "name". Any idea whats wrong?
>
> Thank you very much,
> Julian
>
> --
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla  
> Firefox 3 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Julian Hagenauer

Re: "PropertyDescriptor is null - did you request a property that does not exist?" ... But it does!

Reply Threaded More More options
Print post
Permalink
Hi,
that is strange: Also the getCapabilities-response lists 1.0.0 as valid (<ows:Parameter name="AcceptVersions">
<ows:Value>1.0.0</ows:Value>
<ows:Value>1.1.0</ows:Value>
</ows:Parameter>)
i get a unknownHost exception, if i add &Version=1.0.0 to the URL. If i add Version 1.1.0 the host is found, but the name-property still is not present. Strange...

Thank you,
Julian

-------- Original-Nachricht --------
> Datum: Thu, 3 Sep 2009 20:11:01 +1000
> Von: Jody Garnett <[hidden email]>
> An: Julian Hagenauer <[hidden email]>
> CC: [hidden email]
> Betreff: Re: [Geotools-gt2-users] "PropertyDescriptor is null - did you request a property that does not exist?" ... But it does!

> Try changing your URL to have "&VERSION=1.0".
> Jody
>
> On 03/09/2009, at 6:10 PM, Julian Hagenauer wrote:
>
> > Hi,
> > sorry for spaming the list with my problems, but after fiddling some  
> > hours with my code, i made no further progress myself solving the  
> > problem.
> > So, this is my code:
> >
> > URL url = new
> URL("http://localhost/geoserver/wfs?request=getCapabilities&srs=EPSG:4326 
> > ");
> > Map<String, Serializable> m = new HashMap<String, Serializable>();
> > m.put(WFSDataStoreFactory.URL.key, url);
> > m.put(WFSDataStoreFactory.TIMEOUT.key, 30000);
> > m.put(WFSDataStoreFactory.MAXFEATURES.key, 10);
> >
> > DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);
> > Query query = new DefaultQuery(wfs.getTypeNames()[i], bbox, new  
> > String[] "osm_id","name"} );
> > FeatureReader ft = wfs.getFeatureReader(query,  
> > Transaction.AUTO_COMMIT);
> >
> > I am trying to access my WFS, explicitly requesting only the ids and  
> > names of the features.
> >
> > This is what java gave me back:
> > 03.09.2009 09:46:02 org.geotools.data.wfs.WFSDataStoreFactory  
> > determineCorrectStrategy
> > INFO: Using WFS Strategy:  
> > org.geotools.data.wfs.v1_1_0.GeoServerStrategy
> > 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> > visit
> > WARNUNG: results[ class java.lang.String ] is not of type class  
> > net.opengis.wfs.ResultTypeType
> > 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> > visit
> > WARNUNG: Binding: {http://www.opengis.net/ows}ServiceType does not  
> > declare a target type
> > 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> > visit
> > WARNUNG: Binding: {http://www.opengis.net/wfs}Base_TypeNameListType  
> > does not declare a target type
> > 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor  
> > visit
> > WARNUNG: Binding: {http://www.opengis.net/wfs}TypeNameListType does  
> > not declare a target type
> > DecribeFT URL for osm_auto:points:
> http://localhost/geoserver/wfs?=&TYPENAME=osm_auto%3Apoints&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28osm_auto%3Dhttp%3A%2F%2Ffoo_domain%2Fkarto%2Fosm_auto%29&
> > java.lang.NullPointerException: PropertyDescriptor is null - did you  
> > request a property that does not exist?
> > at org.geotools.feature.type.ComplexTypeImpl.<init>
> > (ComplexTypeImpl.java:71)
> > at org.geotools.feature.type.FeatureTypeImpl.<init>
> > (FeatureTypeImpl.java:50)
> > at org.geotools.feature.simple.SimpleFeatureTypeImpl.<init>
> > (SimpleFeatureTypeImpl.java:55)
> > at  
> > org.geotools.feature.type.FeatureTypeFactoryImpl.createSimpleFeatureType
> > (FeatureTypeFactoryImpl.java:154)
> > at  
> > org.geotools.feature.simple.SimpleFeatureTypeBuilder.buildFeatureType
> > (SimpleFeatureTypeBuilder.java:850)
> > at org.geotools.data.DataUtilities.createSubType(DataUtilities.java:
> > 1303)
> > at  
> > org.geotools.data.wfs.v1_1_0.parsers.FeatureCollectionParser.parse
> > (FeatureCollectionParser.java:65)
> > at org.geotools.data.wfs.protocol.wfs.WFSExtensions.process
> > (WFSExtensions.java:75)
> > at org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getFeatureReader
> > (WFS_1_1_0_DataStore.java:325)
> > at myprog.loadFeaturesFromWFS(MyProg.java:94)
> >
> > So, basically it says, that there is no property called name. I  
> > sniffed the network traffic and this is the schema, that is returend  
> > to geotools during the request:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:gml="http://www.opengis.net/gml 
> > " xmlns:osm_auto="http://foo_domain/karto/osm_auto"  
> > elementFormDefault="qualified"
> targetNamespace="http://foo_domain/karto/osm_auto 
> > ">
> >  <xsd:import namespace="http://www.opengis.net/gml"
> schemaLocation="http://localhost:80/geoserver/schemas/gml/3.1.1/base/gml.xsd 
> > "/>
> >  <xsd:complexType name="pointsType">
> >    <xsd:complexContent>
> >      <xsd:extension base="gml:AbstractFeatureType">
> >        <xsd:sequence>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="osm_id"  
> > nillable="true" type="xsd:int"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="name"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="type"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="public_tran"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="amenity"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="shop"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="tourism"  
> > nillable="true" type="xsd:string"/>
> >          <xsd:element maxOccurs="1" minOccurs="0" name="the_geom"  
> > nillable="true" type="gml:PointPropertyType"/>
> >        </xsd:sequence>
> >      </xsd:extension>
> >    </xsd:complexContent>
> >  </xsd:complexType>
> >  <xsd:element name="points" substitutionGroup="gml:_Feature"  
> > type="osm_auto:pointsType"/>
> > </xsd:schema>
> >
> > So, the schema does explicity state that there is a property called  
> > "name". Any idea whats wrong?
> >
> > Thank you very much,
> > Julian
> >
> > --
> > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla  
> > Firefox 3 -
> > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
> >
> >
> ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> > 30-Day
> > trial. Simplify your report design, integration and deployment - and  
> > focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > Geotools-gt2-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users