Hi,
Ouch, your dependencies and configuration looks fine, this looks like
some cast error when generating the SQL query.
This looks like a bug \ error specific to Oracle, you should have a
stack trace in the log files, can you share it with us ?
Best regards,
Nuno Oliveira
On Thu, 2018-12-13 at 23:14 +0000, Sexton Michael wrote:
> Nuno,
>
> That looks like exactly what I am after, thank you. However, in
> implementing it I encounter another problem:
>
> <ServiceException>
> java.lang.RuntimeException: java.lang.RuntimeException: Error
> applying mapping with targetAttribute
> er:sourceReferencejava.lang.RuntimeException: Error applying mapping
> with targetAttribute er:sourceReferenceError applying mapping with
> targetAttribute
> er:sourceReferenceorg.geotools.data.oracle.OracleDialect cannot be
> cast to org.geotools.jdbc.BasicSQLDialect
> </ServiceException>
>
> For reference, my Mapping file data store is this
>
> <DataStore>
> <id>datastore</id>
> <parameters>
> <Parameter>
> <name>dbtype</name>
> <value>Oracle</value>
> </Parameter>
> <Parameter>
> <name>jndiReferenceName</name>
> <value>jdbc/earthresource-ora</value>
> </Parameter>
> <Parameter>
> <name>schema</name>
> <value>EARTHRESOURCE</value>
> </Parameter>
> <Parameter>
> <name>Expose primary keys</name>
> <value>true</value>
> </Parameter>
> </parameters>
> </DataStore>
>
> JNDI config is (with identifying parameters removed)
>
> <Resource name="jdbc/earthresource-ora"
> auth="Container"
> type="javax.sql.DataSource"
> username="#####"
> password="#####"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> driverClassName="oracle.jdbc.OracleDriver"
> url="jdbc:oracle:thin:@#####:1234/#####"
> maxActive="15"
> maxIdle="5"
> maxWait="10000"
> removeAbandoned="true"
> removeAbandonedTimeout="60"
> logAbandoned="true"
> testOnBorrow="true"
> defaultAutoCommit="false"
> validationQuery="SELECT 1 FROM DUAL"
> testWhileIdle="true"
> timeBetweenEvictionRunsMillis="10000"
> minEvictableIdleTimeMillis="60000"
> numTestsPerEvictionRun="5"
> accessToUnderlyingConnectionAllowed="true"/>
>
> And dependencies in pom.xml are
>
> <dependencies>
> <dependency>
> <groupId>org.geoserver</groupId>
> <artifactId>gs-main</artifactId>
> </dependency>
> <dependency>
> <groupId>org.geoserver.web</groupId>
> <artifactId>gs-web-app</artifactId>
> <version>${gs.version}</version>
> </dependency>
> <dependency>
> <groupId>org.geotools</groupId>
> <artifactId>gt-app-schema</artifactId>
> <version>${gt.version}</version>
> </dependency>
> <dependency>
> <groupId>org.geotools</groupId>
> <artifactId>gt-process</artifactId>
> </dependency>
> <dependency>
> <groupId>org.geoserver</groupId>
> <artifactId>gs-xslt</artifactId>
> <version>${gs.version}</version>
> </dependency>
> <dependency>
> <groupId>org.geotools.jdbc</groupId>
> <artifactId>gt-jdbc-oracle</artifactId>
> </dependency>
> <dependency>
> <groupId>org.geoserver.extension</groupId>
> <artifactId>gs-oracle</artifactId>
> <version>${gs.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.tomcat</groupId>
> <artifactId>tomcat-jdbc</artifactId>
> <version>7.0.28</version>
> </dependency>
> <dependency>
> <groupId>com.oracle</groupId>
> <artifactId>ojdbc7</artifactId>
> </dependency>
> </dependencies>
>
> Is there some other configuration necessary to get this to work?
>
> Kind regards,
>
> Michael
>
>
> From: Nuno Oliveira [mailto:[email protected]]
> Sent: Thursday, 13 December 2018 8:12 PM
> To: Sexton Michael; [email protected]
> Subject: Re: [Geoserver-users] App-schema: mapping simple attribute
> as a feature link [SEC=UNCLASSIFIED]
>
> Hi,
>
> Interesting use case indeed, er:MineralOccurrence is not a simple
> property so it seems that App-Schema does handle it correctly.
>
> Quick suggestion: give it a quick try with the recently introduced
> syntax for SQL mappings with cardinality 0\2..N:
> https://docs.geoserver.org/stable/en/user/data/app-schema/mapping-fil
> e.html#attributes-with-cardinality-1-n
>
> Best regards,
>
> Nuno Oliveira
>
>
> On Thu, 2018-12-13 at 02:25 +0000, Sexton Michael wrote:
> Hi
>
> I’m following the example mapping file here to map a simple attribute
> field from another table multiple times:
>
> https://github.com/geoserver/geoserver/blob/master/src/extension/app-
> schema/app-schema-test/src/test/resources/test-
> data/SimpleAttributeFeatureChainTest.xml
>
> This is the mapping file:
>
> <typeMappings>
> <FeatureTypeMapping>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>MV_ER_MINERALOCCURRENCE</sourceType>
> <targetElement>er:MineralOccurrence</targetElement>
>
> <attributeMappings>
> <AttributeMapping>
>
> er:MineralOccurrence
> <idExpression>
> <OCQL>GML_ID</OCQL>
> </idExpression>
> </AttributeMapping>
> <AttributeMapping>
> <targetAttribute>gml:identifier</targetAttribute>
> <sourceExpression>
> <OCQL>IDENTIFIER</OCQL>
> </sourceExpression>
> <ClientProperty>
> <name>codeSpace</name>
> <value>IDENTIFIER_CODESPACE</value>
> </ClientProperty>
> </AttributeMapping>
> <AttributeMapping>
> <targetAttribute>gml:name</targetAttribute>
> <sourceExpression>
> <OCQL>NAME</OCQL>
> </sourceExpression>
> </AttributeMapping>
>
> <AttributeMapping>
> <targetAttribute>er:sourceReference</targetAttribute>
> <sourceExpression>
> <OCQL>ENO</OCQL>
> <linkElement>SOURCEREFERENCE</linkElement>
> <linkField>FEATURE_LINK[2]</linkField>
> </sourceExpression>
> </AttributeMapping>
> </attributeMappings>
> </FeatureTypeMapping>
> <FeatureTypeMapping>
> <mappingName>SOURCEREFERENCE</mappingName>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>MV_ER_SOURCEREFERENCE</sourceType>
> <targetElement>er:sourceReference</targetElement>
> <attributeMappings>
>
> <AttributeMapping>
> <targetAttribute>er:sourceReference</targetAttribute>
> <ClientProperty>
> <name>xlink:href</name>
> <value>URI</value>
> </ClientProperty>
>
> <ClientProperty>
> <name>xlink:title</name>
> <value>TITLE</value>
> </ClientProperty>
> </AttributeMapping>
> <AttributeMapping>
> <targetAttribute>FEATURE_LINK[2]</targetAttribute>
> <sourceExpression>
> <OCQL>ENO</OCQL>
> </sourceExpression>
> </AttributeMapping>
> </attributeMappings>
> </FeatureTypeMapping>
>
>
> The sourceReference attribute is defined in http://schemas.earthresou
> rceml.org/2.0/mineralOccurrence.xsd as:
>
>
> nillable="true">
> <annotation>
> <appinfo>
>
> >gmd2:CI_Citation;
> </appinfo>
> </annotation>
> <complexType>
> <complexContent>
> <extension base="gml:AbstractMetadataPropertyType">
> <sequence/>
>
> ref="gml:AssociationAttributeGroup"/>
> </extension>
> </complexContent>
> </complexType>
> </element>
>
> But I get this error:
>
> Error occurred getting featuresjava.util.NoSuchElementException: No
> top level element found in schemas: {http://xmlns.earthresourceml.org
> /EarthResource/2.0}sourceReferenceNo top level element found in
> schemas:
> {http://xmlns.earthresourceml.org/EarthResource/2.0}sourceReference
>
> I’ve seen this error before, when trying to map gml:metadataProperty,
> which I managed to get around using the targetAttributeNode, eg:
>
> <mappingName>METADATA</mappingName>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>MV_CIT_CI_CITATION</sourceType>
> <targetElement>gml:metaDataProperty</targetElement>
> <attributeMappings>
>
> <AttributeMapping>
>
> gml:metaDataProperty/gml:GenericMetaData
> ibute>
>
> mrl:LI_Source_PropertyType
> </AttributeMapping>
>
>
> But in the case of er:soruceReference, there is no node to map to.
> It’s a reference intended to have xlink:href and xlink:title
> attributes. Is there a solution here?
>
> Thanks
>
>
> Michael Sexton
>
> Geoscience Australia Disclaimer: This e-mail (and files transmitted
> with it) is intended only for the person or entity to which it is
> addressed. If you are not the intended recipient, then you have
> received this e-mail by mistake and any use, dissemination,
> forwarding, printing or copying of this e-mail and its file
> attachments is prohibited. The security of emails transmitted cannot
> be guaranteed; by forwarding or replying to this email, you
> acknowledge and accept these risks.
> -------------------------------------------------------------------
> ------------------------------------------------------
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting
> to this list:
> - Earning your support instead of buying it, but Ian Turton: http://w
> ww.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines: http://geoserver.org/co
> mm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this: ht
> tps://github.com/geoserver/geoserver/wiki/Successfully-requesting-
> and-integrating-new-features-and-improvements-in-GeoServer
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
> --
> Regards,
> Nuno Oliveira
> ==
> GeoServer Professional Services from the
> experts!
> Visit http://goo.gl/it488V for more information.
> ==
>
> Nuno Miguel Carvalho Oliveira
> @nmcoliveira
> Software Engineer
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> Con riferimento alla normativa sul trattamento dei dati
> personali (Reg. UE 2016/679 - Regolamento generale sulla
> protezione dei dati “GDPR”), si precisa che ogni
> circostanza inerente alla presente email (il suo contenuto,
> gli eventuali allegati, etc.) è un dato la cui conoscenza
> è riservata al/i solo/i destinatario/i indicati dallo
> scrivente. Se il messaggio Le è giunto per errore, è
> tenuta/o a cancellarlo, ogni altra operazione è illecita.
> Le sarei comunque grato se potesse darmene notizia.
>
> This email is intended only for the person or entity to
> which it is addressed and may contain information that
> is privileged, confidential or otherwise protected from
> disclosure. We remind that - as provided by European
> Regulation 2016/679 “GDPR” - copying, dissemination or
> use of this e-mail or the information herein by anyone
> other than the intended recipient is prohibited. If you
> have received this email by mistake, please notify
> us immediately by telephone or e-mail.
> Geoscience Australia Disclaimer: This e-mail (and files transmitted
> with it) is intended only for the person or entity to which it is
> addressed. If you are not the intended recipient, then you have
> received this e-mail by mistake and any use, dissemination,
> forwarding, printing or copying of this e-mail and its file
> attachments is prohibited. The security of emails transmitted cannot
> be guaranteed; by forwarding or replying to this email, you
> acknowledge and accept these risks.
> -------------------------------------------------------------------
> ------------------------------------------------------
--
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts!
Visit http://goo.gl/it488V for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Con riferimento alla normativa sul trattamento dei dati
personali (Reg. UE 2016/679 - Regolamento generale sulla
protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto,
gli eventuali allegati, etc.) è un dato la cui conoscenza
è riservata al/i solo/i destinatario/i indicati dallo
scrivente. Se il messaggio Le è giunto per errore, è
tenuta/o a cancellarlo, ogni altra operazione è illecita.
Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to
which it is addressed and may contain information that
is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European
Regulation 2016/679 “GDPR” - copying, dissemination or
use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you
have received this email by mistake, please notify
us immediately by telephone or e-mail.
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users