TransWikia.com

Error creating Geoserver App-schema Store with Postgres: "AttributeTypeImpl cannot be cast to ComplexType"

Geographic Information Systems Asked by fambrosi on June 8, 2021

I have this postgis table

el_str( classid varying(70), meta_ist_data_cre date, meta_ist_data_mod date, meta_ist_ent_for character varying(100), meta_ist_livello numeric(15,0),meta_ist_origine character varying(80), meta_ist_scala character varying(80),
meta_ist_tipo_mod character varying(80),el_str_tra geometry)

I have created the datastore.xml file and mapping file el_str.xml and this is a simple mapping:

<targetTypes>
    <FeatureType>
        <schemaUri>newxsd.xsd</schemaUri>
    </FeatureType>
</targetTypes>
<typeMappings>
    <FeatureTypeMapping>
        <sourceDataStore>datastore</sourceDataStore>
        <sourceType>el_str</sourceType>
        <targetElement>IT:EL_STR</targetElement>
        <attributeMappings>
    <AttributeMapping>
                <targetAttribute>IT:EL_STR</targetAttribute>
                <idExpression>
                    <OCQL>getId()</OCQL>
                </idExpression>
            </AttributeMapping>
        </attributeMappings>
    </FeatureTypeMapping>
</typeMappings>

The xsd file (newxsd.xsd) its:

<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault="qualified" attributeFormDefault="unqualified" version="3.0"    targetNamespace="http://webgisproject.no-ip.org" xml:lang="it" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink">

<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>


<element name="EL_STR" type="IT:EL_STRType" substitutionGroup="gml:_Feature"/>

<complexType name="EL_STRType">
    <complexContent>
        <extension base="gml:AbstractFeatureType">
            <sequence>
                <element name="UUID" minOccurs="1" maxOccurs="1" />
                <element name="EL_STR_TRA" type="gml:CurvePropertyType" minOccurs="1" maxOccurs="2" />
                <element name="META_IST_DATA_CRE" minOccurs="1" maxOccurs="1"/>
                <element name="META_IST_DATA_MOD" minOccurs="1" maxOccurs="1"/>
                <element name="META_IST_ENT_FOR" minOccurs="1" maxOccurs="1"/>
                <element name="META_IST_LIVELLO" minOccurs="1" maxOccurs="1"/>

            </sequence>
        </extension>
    </complexContent>
</complexType>

</schema>

When I enable IT_el_str store I have this error:

Original exception error:

org.geotools.feature.type.AttributeTypeImpl cannot be cast to org.opengis.feature.type.ComplexType

In catalina.out there are this warnings/errors:

WARN [data.complex] - IT:EL_STRType has no super type
WARN [data.store] - Error obtaining datatore with modified values
java.io.IOException
...
...
Caused by: org.geotools.feature.type.AttributeTypeImpl cannot be cast to org.opengis.feature.type.ComplexType

Do you have any idea??
Thanks

One Answer

The problems were in newxsd.xsd:

  • in the tag missing the namespace xmlns:IT="http://webgisproject.no-ip.org",
  • for each element tag of complexType missing the type attribute.

Solved :)

Correct answer by fambrosi on June 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP