Hi Ben,thanks for your answer, please see my comments below.
Da: "Ben Caradoc-Davies" [email protected] A: "stefano.costa" [email protected] Cc: "[email protected]" [email protected] Data: Tue, 14 Jul 2015 10:44:54 +1200 Oggetto: Re: App-schema issue mapping GeologyCore INSPIRE schema > I could not see anything obvious in your mapping file. Do you have a > secondary namespace configured for gml? > http://docs.geoserver.org/latest/en/user/data/app-schema/supported-gml-versions.html#secondary-namespace-for-gml-3-2-1-required Yes, I do, namespace.xml: <namespace><id>NamespaceInfoImpl--5e80c53:14e0c255a07:-6795</id><prefix>gml</prefix><uri>http://www.opengis.net/gml/3.2</uri></namespace> ...and workspace.xml: <workspace><id>WorkspaceInfoImpl--5e80c53:14e0c255a07:-6794</id><name>gml</name></workspace> > I did not see anything obviously wrong with the schemas, either. > GeoServer app-schema guesses GML version based on whether a GML 3.1 or > 3.2 feature base type is present. I did not see anything that could > import GML 3.1.1. > > In the past I have seen GML 3.2.1 application schemas that mistakenly > import GML 3.1.1 and cause GeoServer app-schema to load the wrong Java > bindings. If GeoServer finds both, it will pick GML 3.1.1; see > SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP and findGmlConfiguration > in GmlFeatureTypeRegistryConfiguration. This is a schema problem as a > GML application schema should use only one version of GML. I created a test case proving that the right GML version is picked: /** * Test we can find that Geology Core 3.0 depends on GML 3.2. */ @Test public void findGeologyConfiguration() { AppSchemaConfiguration configuration = new AppSchemaConfiguration( "http://inspire.ec.europa.eu/schemas/ge-core/3.0", "http://inspire.ec.europa.eu/schemas/ge-core/3.0/GeologyCore.xsd", new SchemaResolver(new SchemaCache(new File("/tmp/app-schema-cache"), true))); Configuration gmlConfiguration = GmlFeatureTypeRegistryConfiguration.findGmlConfiguration(configuration); Assert.assertNotNull(gmlConfiguration); Assert.assertEquals(new org.geotools.gml3.v3_2.GMLConfiguration(), gmlConfiguration); } The test passes, as expected. > > Try removing your app-schema-cache and restarting (with only this one > feature type mapped) to see if any GML 3.1.1 schemas are downloaded into > the cache. I cleared the cache, restarted and checked the version of the downloaded gml.xsd: 3.2.1.2, which is correct. I made further experiments and noticed that if I define a FeatureTypeMapping for ge:NaturalGeomorphologicFeatureType, everything works as expected; if I just define a FeatureTypeMapping for ge:MappedFeature and use element ge:NaturalGeomorphologicFeature in its attribute mappings, the "Could not find type..." exception occurs. Inspecting the code, I found out that for mapped feature types an attribute descriptor is created and the element declaration is stored in the userData map of the descriptor: https://github.com/geotools/geotools/blob/aa0d0346e4bb4a5a2055559c22d2b12ded7cbd20/modules/extension/complex/src/main/java/org/geotools/data/complex/config/FeatureTypeRegistry.java#L355 Then, when a request comes in and the properties of the feature type must be extracted, the XSD type definition is retrieved from the userData map: https://github.com/geotools/geotools/blob/aa0d0346e4bb4a5a2055559c22d2b12ded7cbd20/modules/extension/xsd/xsd-gml2/src/main/java/org/geotools/gml2/bindings/GMLEncodingUtils.java#L135 On the contrary, if a feature type is not mapped, the descriptor's userData map is empty and the XSD type definition cannot be found: thus, a "Could not find type ..." exception is raised. I created a patch to fix this, by taking the type definition from the element declaration that is passed as an argument to the AbstractFeatureType_getProperties method: in my case, this solves the problem, but I'm not at all sure this approach is correct (I'll frankly admit I don't fully understand what the code is doing here). I'm attaching an updated version of the mapping file and the patch in diff format: if you think it's useful, I can make a PR. > > Kind regards, > Ben. Thanks, Stefano > > On 14/07/15 00:43, stefano.costa wrote: > > Hi all, > > I'm facing an issue with a simple app-schema mapping targeting the Geology > > Core INSPIRE schema, which can be found here: > > file:///home/stefano/Lavoro/GeoSolutions/projects/hale/geoserver-2.6.2/data_dir/app-schema-cache/eu/europa/ec/inspire/schemas/ge-core/3.0/GeologyCore.xsd > > > > I'm attaching a simplified version of the mapping file. > > > > Example request: > > http://localhost:8080/geoserver/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=ge:MappedFeature&maxFeatures=50&outputFormat=application%2Fgml%2Bxml%3B+version%3D3.2 > > > > Stack trace of the error: > > java.lang.RuntimeException: Failed to get properties. Binding for > > {http://www.opengis.net/gml}AbstractFeatureType > > at > > org.geotools.xml.impl.GetPropertiesExecutor.visit(GetPropertiesExecutor.java:72) > > at > > org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:220) > > at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:186) > > at > > org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:47) > > at > > org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:32) > > at > > org.geotools.xml.impl.BindingPropertyExtractor.properties(BindingPropertyExtractor.java:96) > > at org.geotools.xml.Encoder.encode(Encoder.java:960) > > at org.geotools.xml.Encoder.encode(Encoder.java:609) > > at > > org.geoserver.wfs.xml.GML32OutputFormat.encode(GML32OutputFormat.java:124) > > at > > org.geoserver.wfs.xml.GML3OutputFormat.complexFeatureStreamIntercept(GML3OutputFormat.java:325) > > at > > org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:277) > > at > > org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:196) > > at org.geoserver.ows.Dispatcher.response(Dispatcher.java:992) > > at > > org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:279) > > at > > org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) > > at > > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) > > at > > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) > > at > > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) > > at > > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) > > at > > org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) > > at > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) > > at > > org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:75) > > at > > org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:71) > > at > > org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71) > > at > > org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:46) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:50) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > > at > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) > > at > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > > at > > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > > at > > org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:54) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > > at > > org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > > at > > org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:83) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > > at > > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) > > at > > org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:53) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > > at > > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > > at > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > > at > > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173) > > at > > org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:135) > > at > > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) > > at > > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:83) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:48) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:44) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) > > at > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) > > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > > at > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) > > at > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) > > at > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) > > at > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) > > at > > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) > > at > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > > at org.mortbay.jetty.Server.handle(Server.java:324) > > at > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) > > at > > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828) > > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) > > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) > > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) > > at > > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) > > at > > org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) > > Caused by: java.lang.RuntimeException: Could not find type for > > {http://inspire.ec.europa.eu/schemas/ge-core/3.0}NaturalGeomorphologicFeatureType > > in schema > > at > > org.geotools.gml2.bindings.GMLEncodingUtils.AbstractFeatureType_getProperties(GMLEncodingUtils.java:140) > > at > > org.geotools.gml3.bindings.GML3EncodingUtils.AbstractFeatureTypeGetProperties(GML3EncodingUtils.java:312) > > at > > org.geotools.gml3.bindings.AbstractFeatureTypeBinding.getProperties(AbstractFeatureTypeBinding.java:145) > > at > > org.geotools.xml.impl.GetPropertiesExecutor.visit(GetPropertiesExecutor.java:65) > > ... 88 more > > > > From the error message of the exception's root cause, marked in red, it > > looks like NaturalGeomorphologicFeatureType was not properly parsed and > > added to the schema index, not sure why. Also the message "Failed to get > > properties. Binding for {http://www.opengis.net/gml}AbstractFeatureType" > > sounds wrong to me: shouldn't have been > > "{http://www.opengis.net/gml/3.2}AbstractFeatureType", since the geology > > schema links to GML 3.2? > > I tried to change output format to "gml3" and the exception disappears, > > although the output is not perfect (e.g. "shape" geometry element is not > > properly encoded): > > > > timeStamp="2015-07-13T12:38:29.217Z" > > xsi:schemaLocation="http://www.opengis.net/wfs > > http://schemas.opengis.net/wfs/1.1.0/wfs.xsd > > http://inspire.ec.europa.eu/schemas/ge-core/3.0 > > http://inspire.ec.europa.eu/schemas/ge-core/3.0/GeologyCore.xsd"> > > > > > > > > > > xlink:href="http://inspire.ec.europa.eu/codelist/MappingFrameValue/surfaceGeology" > > xlink:type="simple" /> > > > > > > > > xlink:href="http://inspire.ec.europa.eu/codelist/GeomorphologicActivityValue/dormant" > > xlink:type="simple" /> > > > > > > > > > > > > I tested with GeoServer 2.7.1 and master, obtaining similar results. > > > > Does anybody have an idea of what might be going wrong? > > > > Best regards, > > Stefano Costa > > > > == > > GeoServer Professional Services from the experts! Visit > > http://goo.gl/it488V for more information. > > == > > Dott. Stefano Costa > > Senior Software Engineer > > > > GeoSolutions S.A.S. > > Via Poggio alle Viti 1187 > > 55054 Massarosa (LU) > > Italy > > phone: +39 0584 962313 > > fax: +39 0584 1660272 > > > > http://www.geo-solutions.it > > http://twitter.com/geosolutions_it > > > > ------------------------------------------------------- > > AVVERTENZE AI SENSI DEL D.Lgs. 196/2003 > > Le informazioni contenute in questo messaggio di posta elettronica e/o > > nel/i file/s allegato/i sono da considerarsi strettamente riservate. > > Il loro utilizzo è consentito esclusivamente al destinatario del > > messaggio, per le finalità indicate nel messaggio stesso. Qualora > > riceviate questo messaggio senza esserne il destinatario, Vi preghiamo > > cortesemente di darcene notizia via e-mail e di procedere alla > > distruzione del messaggio stesso, cancellandolo dal Vostro sistema. > > Conservare il messaggio stesso, divulgarlo anche in parte, > > distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità > > diverse, costituisce comportamento contrario ai principi dettati dal > > D.Lgs. 196/2003. > > > > The information in this message and/or attachments, is intended solely > > for the attention and use of the named addressee(s) and may be > > confidential or proprietary in nature or covered by the provisions of > > privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New > > Data Protection Code).Any use not in accord with its purpose, any > > disclosure, reproduction, copying, distribution, or either > > dissemination, either whole or partial, is strictly forbidden except > > previous formal approval of the named addressee(s). If you are not the > > intended recipient, please contact immediately the sender by > > telephone, fax or e-mail and delete the information in this message > > that has been received in error. The sender does not give any warranty > > or accept liability as the content, accuracy or completeness of sent > > messages and accepts no responsibility for changes made after they > > were sent or for other risks which arise as a result of e-mail > > transmission, viruses, etc. > > > > > > > > ------------------------------------------------------------------------------ > > Don't Limit Your Business. Reach for the Cloud. > > GigeNET's Cloud Solutions provide you with the tools and support that > > you need to offload your IT needs and focus on growing your business. > > Configured For All Businesses. Start Your Cloud Today. > > https://www.gigenetcloud.com/ > > > > > > > > _______________________________________________ > > GeoTools-GT2-Users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > > > -- > Ben Caradoc-Davies > Director > Transient Software Limited > New Zealand Best regards, Stefano Costa == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Dott. Stefano Costa Senior Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- AVVERTENZE AI SENSI DEL D.Lgs. 196/2003 Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.
patch.diff
Description: Binary data
GeologyCore.appschema
Description: Binary data
------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/
_______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
