[Geoserver-users] App Schema Resolution

Christy,

this is a serious configuration error: "org.xml.sax.SAXParseException: Content is not allowed in prolog." It means that an XML file is not well-formed. An XML declaration like '<?xml version="1.0" encoding="UTF-8"?>' if present must be the very first bytes in the file. Any XML comment must be after the declaration, and there cannot be any non-comment bare text before the root element. Please also check that you do not have a byte order mark (Notepad is notorious for adding these):
http://en.wikipedia.org/wiki/Byte_order_mark

This is also a very serious Java error: "java.lang.VerifyError: Cannot inherit from final class". It suggests that you have plugins from different versions of GeoServer with incompatible APIs. What version of GeoServer, app-schema, and oracle plugins are you using? They should all come from the same build.

Kind regards,
Ben.

On 13/03/13 00:55, Christy Caudill wrote:

Perhaps this bit, with the "Cannot inherit from final class" error is most useful for the tutorial error I'm experiencing:

org.xml.sax.SAXParseException: Content is not allowed in prolog.
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.commons.digester.Digester.parse(Digester.java:1685)
  at org.geotools.data.complex.config.XMLConfigDigester.digest(XMLConfigDigester.java:166)
  ... 114 more
2013-03-11 07:48:27,266 INFO [org.geoserver] - Loaded feature type 'BoreholeTemperature', enabled
2013-03-11 07:48:27,280 INFO [org.geoserver] - Loaded feature type 'azboreholetemperatures'
2013-03-11 07:48:27,297 INFO [org.geoserver] - Loaded layer 'BoreholeTemperature'
2013-03-11 07:48:27,313 INFO [org.geoserver] - Loaded store 'azdrillstemtests', enabled
2013-03-11 07:48:27,314 INFO [org.geoserver] - Loaded data store 'azdrillstemtests'
2013-03-11 07:48:27,477 INFO [org.geoserver] - Loaded feature type 'DrillStemTestx', enabled
2013-03-11 07:48:27,478 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,497 INFO [org.geoserver] - Loaded layer 'DrillStemTestx'
2013-03-11 07:48:27,533 INFO [org.geoserver] - Loaded feature type 'DrillStemTest', enabled
2013-03-11 07:48:27,539 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,551 INFO [org.geoserver] - Loaded layer 'DrillStemTest'
2013-03-11 07:48:27,575 INFO [org.geoserver] - Loaded store 'tut_RoadSegment', enabled
2013-03-11 07:48:27,576 INFO [org.geoserver] - Loaded data store 'tut_RoadSegment'
2013-03-11 07:48:39,815 WARN [org.geoserver] - Error connecting to 'tut_RoadSegment'. Disabling.
2013-03-11 07:48:39,816 INFO [org.geoserver] -
java.lang.VerifyError: Cannot inherit from final class
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
  at org.geotools.xml.AppSchemaConfiguration.<init>(AppSchemaConfiguration.java:54)
  at org.geotools.data.complex.config.EmfAppSchemaReader.parse(EmfAppSchemaReader.java:126)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.parseGmlSchemas(AppSchemaDataAccessConfigurator.java:557)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:189)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:168)
  at org.geotools.data.complex.AppSchemaDataAccessFactory.createDataStore(AppSchemaDataAccessFactory.java:96)

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Christy,

here is the offending XML file (from the log you sent me):

2013-03-11 08:03:38,291 ERROR [complex.config] - parsing file:/var/lib/tomcat6/webapps/geoserver/data/workspaces/aasg/azboreholetemperatures/BoreholeTemperature2.xml
org.xml.sax.SAXParseException: Content is not allowed in prolog.

I also do not like this:

2013-03-11 08:21:03,601 ERROR [org.geoserver] - Error occurred while saving configuration
java.io.FileNotFoundException: /var/lib/tomcat6/webapps/geoserver/data/wms.xml (Permission denied)

If you manually deployed the WAR file or edited files as root, you should also ensure the permissions are fixed with:

chmod -R go+rX /var/lib/tomcat6/webapps/geoserver
chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/geoserver

Otherwise, tomcat will not be able to persist changes. This might not be an issue for app-schema deployments, but it will cause strange errors.

Kind regards,
Ben.

On 13/03/13 09:27, Ben Caradoc-Davies wrote:

Christy,

this is a serious configuration error: "org.xml.sax.SAXParseException:
Content is not allowed in prolog." It means that an XML file is not
well-formed. An XML declaration like '<?xml version="1.0"
encoding="UTF-8"?>' if present must be the very first bytes in the file.
Any XML comment must be after the declaration, and there cannot be any
non-comment bare text before the root element. Please also check that
you do not have a byte order mark (Notepad is notorious for adding these):
http://en.wikipedia.org/wiki/Byte_order_mark

This is also a very serious Java error: "java.lang.VerifyError: Cannot
inherit from final class". It suggests that you have plugins from
different versions of GeoServer with incompatible APIs. What version of
GeoServer, app-schema, and oracle plugins are you using? They should all
come from the same build.

Kind regards,
Ben.

On 13/03/13 00:55, Christy Caudill wrote:

Perhaps this bit, with the "Cannot inherit from final class" error is
most useful for the tutorial error I'm experiencing:

org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1685)
at
org.geotools.data.complex.config.XMLConfigDigester.digest(XMLConfigDigester.java:166)

... 114 more
2013-03-11 07:48:27,266 INFO [org.geoserver] - Loaded feature type
'BoreholeTemperature', enabled
2013-03-11 07:48:27,280 INFO [org.geoserver] - Loaded feature type
'azboreholetemperatures'
2013-03-11 07:48:27,297 INFO [org.geoserver] - Loaded layer
'BoreholeTemperature'
2013-03-11 07:48:27,313 INFO [org.geoserver] - Loaded store
'azdrillstemtests', enabled
2013-03-11 07:48:27,314 INFO [org.geoserver] - Loaded data store
'azdrillstemtests'
2013-03-11 07:48:27,477 INFO [org.geoserver] - Loaded feature type
'DrillStemTestx', enabled
2013-03-11 07:48:27,478 INFO [org.geoserver] - Loaded feature type
'azdrillstemtests'
2013-03-11 07:48:27,497 INFO [org.geoserver] - Loaded layer
'DrillStemTestx'
2013-03-11 07:48:27,533 INFO [org.geoserver] - Loaded feature type
'DrillStemTest', enabled
2013-03-11 07:48:27,539 INFO [org.geoserver] - Loaded feature type
'azdrillstemtests'
2013-03-11 07:48:27,551 INFO [org.geoserver] - Loaded layer
'DrillStemTest'
2013-03-11 07:48:27,575 INFO [org.geoserver] - Loaded store
'tut_RoadSegment', enabled
2013-03-11 07:48:27,576 INFO [org.geoserver] - Loaded data store
'tut_RoadSegment'
2013-03-11 07:48:39,815 WARN [org.geoserver] - Error connecting to
'tut_RoadSegment'. Disabling.
2013-03-11 07:48:39,816 INFO [org.geoserver] -
java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)

at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)

at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)

at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)

at
org.geotools.xml.AppSchemaConfiguration.<init>(AppSchemaConfiguration.java:54)

at
org.geotools.data.complex.config.EmfAppSchemaReader.parse(EmfAppSchemaReader.java:126)

at
org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.parseGmlSchemas(AppSchemaDataAccessConfigurator.java:557)

at
org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:189)

at
org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:168)

at
org.geotools.data.complex.AppSchemaDataAccessFactory.createDataStore(AppSchemaDataAccessFactory.java:96)

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

[Back on the list so anyone seeing this error can apply your fix.]

Good to hear.

On 13/03/13 23:28, Christy Caudill wrote:

Hi Ben,

You were right about the first error - there were some funky characters that were found before the first line. We removed those and that error went away, to be replaced by the same error that I was getting with the tutorial. So, onto the "Cannot inherit from final class" error ...
Geoserver version: 2.1.2
App-Schema jar files: 8.2.jars and 9.0-RC1.jars downloaded; I have downloaded the geoserver 2.0 beta2 app-schema plugin.
I do not have Oracle plug-ins, as I am connecting to PostGIS database.

I assume that I need a different version of the app-schema files? Perhaps instead I need to get this extension: http://sourceforge.net/projects/geoserver/files/GeoServer%20Extensions/2.1.2/

Thanks again for your time and consideration.

Christy

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@anonymised.com]
Sent: Tuesday, March 12, 2013 6:27 PM
To: christy.caudill@anonymised.com
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: App Schema Resolution

Christy,

this is a serious configuration error: "org.xml.sax.SAXParseException:
Content is not allowed in prolog." It means that an XML file is not well-formed. An XML declaration like '<?xml version="1.0"
encoding="UTF-8"?>' if present must be the very first bytes in the file.
Any XML comment must be after the declaration, and there cannot be any non-comment bare text before the root element. Please also check that you do not have a byte order mark (Notepad is notorious for adding these):
http://en.wikipedia.org/wiki/Byte_order_mark

This is also a very serious Java error: "java.lang.VerifyError: Cannot inherit from final class". It suggests that you have plugins from different versions of GeoServer with incompatible APIs. What version of GeoServer, app-schema, and oracle plugins are you using? They should all come from the same build.

Kind regards,
Ben.

On 13/03/13 00:55, Christy Caudill wrote:

Perhaps this bit, with the "Cannot inherit from final class" error is most useful for the tutorial error I'm experiencing:

org.xml.sax.SAXParseException: Content is not allowed in prolog.
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.commons.digester.Digester.parse(Digester.java:1685)
  at org.geotools.data.complex.config.XMLConfigDigester.digest(XMLConfigDigester.java:166)
  ... 114 more
2013-03-11 07:48:27,266 INFO [org.geoserver] - Loaded feature type
'BoreholeTemperature', enabled
2013-03-11 07:48:27,280 INFO [org.geoserver] - Loaded feature type 'azboreholetemperatures'
2013-03-11 07:48:27,297 INFO [org.geoserver] - Loaded layer 'BoreholeTemperature'
2013-03-11 07:48:27,313 INFO [org.geoserver] - Loaded store
'azdrillstemtests', enabled
2013-03-11 07:48:27,314 INFO [org.geoserver] - Loaded data store 'azdrillstemtests'
2013-03-11 07:48:27,477 INFO [org.geoserver] - Loaded feature type
'DrillStemTestx', enabled
2013-03-11 07:48:27,478 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,497 INFO [org.geoserver] - Loaded layer 'DrillStemTestx'
2013-03-11 07:48:27,533 INFO [org.geoserver] - Loaded feature type
'DrillStemTest', enabled
2013-03-11 07:48:27,539 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,551 INFO [org.geoserver] - Loaded layer 'DrillStemTest'
2013-03-11 07:48:27,575 INFO [org.geoserver] - Loaded store
'tut_RoadSegment', enabled
2013-03-11 07:48:27,576 INFO [org.geoserver] - Loaded data store 'tut_RoadSegment'
2013-03-11 07:48:39,815 WARN [org.geoserver] - Error connecting to 'tut_RoadSegment'. Disabling.
2013-03-11 07:48:39,816 INFO [org.geoserver] -
java.lang.VerifyError: Cannot inherit from final class
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
  at org.geotools.xml.AppSchemaConfiguration.<init>(AppSchemaConfiguration.java:54)
  at org.geotools.data.complex.config.EmfAppSchemaReader.parse(EmfAppSchemaReader.java:126)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.parseGmlSchemas(AppSchemaDataAccessConfigurator.java:557)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:189)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:168)
  at
org.geotools.data.complex.AppSchemaDataAccessFactory.createDataStore(A
ppSchemaDataAccessFactory.java:96)

--
Ben Caradoc-Davies<Ben.Caradoc-Davies@anonymised.com> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

[Back on the list]

Christy,

is the first argument to strConcat a string literal? Is it surrounded by string quotes?
http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#sourceexpression-optional
http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#cql

There are a few other tricks like using strTrim(getId()) to turn source feature IDs, which are similar to strings but not quite the same, into real CQL-compatible strings:
http://docs.geoserver.org/latest/en/user/data/app-schema/feature-chaining.html

The geoserver-users list is a good source of CQL advice.

Kind regards,
Ben.

On 14/03/13 03:08, Christy Caudill wrote:

And you were correct about the second error! It seems I simply needed to ensure that my Geoserver instance and the app-schema versions were the same. Now the tutorial is working! The GetFeature requests returns the indicated schema location and data. My layer created by my xml files now returns on a GetFeature request:

java.lang.IllegalArgumentException: Filter Function problem for function strConcat argument #1 - expected type String

I will look at my and the tutorial's mapping files, and I should be able to find the problem from there. Thanks again for your advice.

-----Original Message-----
From: Christy Caudill [mailto:christy.caudill@anonymised.com]
Sent: Wednesday, March 13, 2013 8:29 AM
To: 'Ben Caradoc-Davies'
Subject: RE: App Schema Resolution

Hi Ben,

You were right about the first error - there were some funky characters that were found before the first line. We removed those and that error went away, to be replaced by the same error that I was getting with the tutorial. So, onto the "Cannot inherit from final class" error ...
Geoserver version: 2.1.2
App-Schema jar files: 8.2.jars and 9.0-RC1.jars downloaded; I have downloaded the geoserver 2.0 beta2 app-schema plugin.
I do not have Oracle plug-ins, as I am connecting to PostGIS database.

I assume that I need a different version of the app-schema files? Perhaps instead I need to get this extension: http://sourceforge.net/projects/geoserver/files/GeoServer%20Extensions/2.1.2/

Thanks again for your time and consideration.

Christy

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@anonymised.com]
Sent: Tuesday, March 12, 2013 6:27 PM
To: christy.caudill@anonymised.com
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: App Schema Resolution

Christy,

this is a serious configuration error: "org.xml.sax.SAXParseException:
Content is not allowed in prolog." It means that an XML file is not well-formed. An XML declaration like '<?xml version="1.0"
encoding="UTF-8"?>' if present must be the very first bytes in the file.
Any XML comment must be after the declaration, and there cannot be any non-comment bare text before the root element. Please also check that you do not have a byte order mark (Notepad is notorious for adding these):
http://en.wikipedia.org/wiki/Byte_order_mark

This is also a very serious Java error: "java.lang.VerifyError: Cannot inherit from final class". It suggests that you have plugins from different versions of GeoServer with incompatible APIs. What version of GeoServer, app-schema, and oracle plugins are you using? They should all come from the same build.

Kind regards,
Ben.

On 13/03/13 00:55, Christy Caudill wrote:

Perhaps this bit, with the "Cannot inherit from final class" error is most useful for the tutorial error I'm experiencing:

org.xml.sax.SAXParseException: Content is not allowed in prolog.
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.commons.digester.Digester.parse(Digester.java:1685)
  at org.geotools.data.complex.config.XMLConfigDigester.digest(XMLConfigDigester.java:166)
  ... 114 more
2013-03-11 07:48:27,266 INFO [org.geoserver] - Loaded feature type
'BoreholeTemperature', enabled
2013-03-11 07:48:27,280 INFO [org.geoserver] - Loaded feature type 'azboreholetemperatures'
2013-03-11 07:48:27,297 INFO [org.geoserver] - Loaded layer 'BoreholeTemperature'
2013-03-11 07:48:27,313 INFO [org.geoserver] - Loaded store
'azdrillstemtests', enabled
2013-03-11 07:48:27,314 INFO [org.geoserver] - Loaded data store 'azdrillstemtests'
2013-03-11 07:48:27,477 INFO [org.geoserver] - Loaded feature type
'DrillStemTestx', enabled
2013-03-11 07:48:27,478 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,497 INFO [org.geoserver] - Loaded layer 'DrillStemTestx'
2013-03-11 07:48:27,533 INFO [org.geoserver] - Loaded feature type
'DrillStemTest', enabled
2013-03-11 07:48:27,539 INFO [org.geoserver] - Loaded feature type 'azdrillstemtests'
2013-03-11 07:48:27,551 INFO [org.geoserver] - Loaded layer 'DrillStemTest'
2013-03-11 07:48:27,575 INFO [org.geoserver] - Loaded store
'tut_RoadSegment', enabled
2013-03-11 07:48:27,576 INFO [org.geoserver] - Loaded data store 'tut_RoadSegment'
2013-03-11 07:48:39,815 WARN [org.geoserver] - Error connecting to 'tut_RoadSegment'. Disabling.
2013-03-11 07:48:39,816 INFO [org.geoserver] -
java.lang.VerifyError: Cannot inherit from final class
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
  at org.geotools.xml.AppSchemaConfiguration.<init>(AppSchemaConfiguration.java:54)
  at org.geotools.data.complex.config.EmfAppSchemaReader.parse(EmfAppSchemaReader.java:126)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.parseGmlSchemas(AppSchemaDataAccessConfigurator.java:557)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:189)
  at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:168)
  at
org.geotools.data.complex.AppSchemaDataAccessFactory.createDataStore(A
ppSchemaDataAccessFactory.java:96)

--
Ben Caradoc-Davies<Ben.Caradoc-Davies@anonymised.com> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

We have achieved schema resolution! That is, as long as we use the getId()
idExpression. However, because we'd like to use our integer field
'objectid', we need to figure out how to concatenate an integer with that
field OR make that read as a string. We tried the following, but we get that
"java.lang.IllegalArgumentException: Filter Function problem for function
strConcat argument #1 - expected type String" error:

                                                            <idExpression>
                                                                       
<OCQL>strConcat('BT', objectid)</OCQL>
                                                            </idExpression>

And we also tried:
                                    <idExpression>
                                                                       
<OCQL>strConcat('BT', strTrim(objectid))</OCQL>
                                                          </idExpression>

Resulting in the same error. Thanks to anyone with ideas.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5040472.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Christy,

this is rather odd. Even if the argument is not a string (and by #1 it means the second argument), the first thing strConcat tries to do is to convert it to a string. The only thing that I can think of that might cause this to fail is that the type is some big integer that it cannot handle, or null. Ordinary integers should be converted.

Can we please see the DDL for the source table?

Is objectid ever null?

select count(1) from yourtablename where objectid is null;

Kind regards,
Ben.

On 15/03/13 04:09, christy@anonymised.com wrote:

We have achieved schema resolution! That is, as long as we use the getId()
idExpression. However, because we'd like to use our integer field
'objectid', we need to figure out how to concatenate an integer with that
field OR make that read as a string. We tried the following, but we get that
"java.lang.IllegalArgumentException: Filter Function problem for function
strConcat argument #1 - expected type String" error:

                                                             <idExpression>

<OCQL>strConcat('BT', objectid)</OCQL>
                                                             </idExpression>

And we also tried:
        <idExpression>
                                                          
<OCQL>strConcat('BT', strTrim(objectid))</OCQL>
                                                       </idExpression>

Resulting in the same error. Thanks to anyone with ideas.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5040472.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Hello Ben,

Please see the attached DDL for the table. As you can see, the objected is never null, and isn't shouldn't be big - it is numbered 1 - 1949.

Thank you,
Christy

-----Original Message-----
From: Ben Caradoc-Davies [mailto:Ben.Caradoc-Davies@anonymised.com]
Sent: Sunday, March 17, 2013 10:14 PM
To: christy@anonymised.com
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] App Schema Resolution

Christy,

this is rather odd. Even if the argument is not a string (and by #1 it means the second argument), the first thing strConcat tries to do is to convert it to a string. The only thing that I can think of that might cause this to fail is that the type is some big integer that it cannot handle, or null. Ordinary integers should be converted.

Can we please see the DDL for the source table?

Is objectid ever null?

select count(1) from yourtablename where objectid is null;

Kind regards,
Ben.

On 15/03/13 04:09, christy@anonymised.com wrote:

We have achieved schema resolution! That is, as long as we use the
getId() idExpression. However, because we'd like to use our integer
field 'objectid', we need to figure out how to concatenate an integer
with that field OR make that read as a string. We tried the following,
but we get that
"java.lang.IllegalArgumentException: Filter Function problem for
function strConcat argument #1 - expected type String" error:

<idExpression>

<OCQL>strConcat('BT', objectid)</OCQL>
                                                             
</idExpression>

And we also tried:
        <idExpression>
                                                          
<OCQL>strConcat('BT', strTrim(objectid))</OCQL>
                                                       </idExpression>

Resulting in the same error. Thanks to anyone with ideas.

--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030
p5040472.html Sent from the GeoServer - User mailing list archive at
Nabble.com.

----------------------------------------------------------------------
-------- Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite
for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre

azboreholetemperaturesDDL.xml (4.42 KB)

Please see the attached DDL for the table. As you can see, the objected is
never null, and isn't be big - it is numbered 1 - 1949.

Thank you,
Christy

azboreholetemperaturesDDL.xml
<http://osgeo-org.1560.n6.nabble.com/file/n5041936/azboreholetemperaturesDDL.xml&gt;

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5041936.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I don't know if this is related or not, but I realize that my GetFeature
request is yielding data in the incorrect fields - the fields each have data
in them that should be in the field above them. The objectid field is the
first field, which is not accounted for when using the getId() as the
IdExpression.

I've attached an image of the GetFeature request, if that helps...

<http://osgeo-org.1560.n6.nabble.com/file/n5042442/GetFeature.png&gt;

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5042442.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Try the Concatenate function … while it also casts to String it is being evil and catching all errors and checking for null.

StringBuffer text = new StringBuffer();
for (Expression expression : (List) getParameters()) {
try {
String str = (String) expression.evaluate(feature, String.class);
if (str != null) {
text.append(str);
}
} catch (Exception couldNotCompute) {
// log me please
}
}

Example: Concatenate(‘BT’,objectid)

Jody Garnett

On Friday, 15 March 2013 at 7:09 AM, christy@anonymised.com wrote:

We have achieved schema resolution! That is, as long as we use the getId()
idExpression. However, because we’d like to use our integer field
‘objectid’, we need to figure out how to concatenate an integer with that
field OR make that read as a string. We tried the following, but we get that
“java.lang.IllegalArgumentException: Filter Function problem for function
strConcat argument #1 - expected type String” error:

strConcat(‘BT’, objectid)

And we also tried:

strConcat(‘BT’, strTrim(objectid))

Resulting in the same error. Thanks to anyone with ideas.


View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5040472.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thank you for the suggestion. I no longer get the error, but it still
doesn't use my objectid in the idExpression:

<http://osgeo-org.1560.n6.nabble.com/file/n5042761/GetFeature_20130325.png&gt;

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5042761.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Please keep messages on-list.

On 27/03/13 23:58, Christy Caudill wrote:

The following made the error go away, though using
Concatenate('BT',objectid) as the idExpression still doesn’t put the
objectid integer in the gml:id.

Aha, that is a good solution. An integer cannot be used for gml:id, as it is of the xs:NCNAME type. These must not start with a digit. Please refer to the XML spec for valid NCNAMEs.

For performance reasons, we strongly recommend avoiding using CQL to generate gml:id in the mapping file as this prevents the use of database indices and the generation of efficient SQL queries.
http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#idexpression
http://docs.geoserver.org/latest/en/user/data/app-schema/joining.html

Actually, in the GetFeature request,
the objectid ends up in the field below it and so on. Even with the
correct field mapping the mapping file, the data is showing up in the
wrong fields. I’ve searched in the Mail Archive and online for similar
errors but can’t seem to find anyone with this specific issue. Does it
sound familiar to you?
Thanks again very much for your time,
Christy

Sorry, I have never seen anything like this.

Kind regards,

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Thanks for the advice in not using CQL in the gml:id - it is not mandatory
that our 'objectid' show there.

We figured out why the data was being returned in the incorrect fields in a
GetFeature request: Our tables were created using ArcMap, which did not
actually specify the OBJECTID as the primary key. Not knowing this, when we
created the mapping file for Geoserver app-schema, we did not indicate this
objectid field anywhere. Yet it was still being read as a data field and
being put into the first field (ObservationURI) regardless of what the
mapping file said. Anyway, we assigned the objectid as the primary key in
the table using PGAdmin and this cleared the issue. GetFeature requests are
now correctly reading the data table and schema.

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-App-Schema-Resolution-tp5040030p5043586.html
Sent from the GeoServer - User mailing list archive at Nabble.com.