GeoServer
  1. GeoServer
  2. GEOS-3681

Native SRS from PostGIS not recognized

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: PostGIS
    • Labels:
      None
    • Environment:
      GeoServer 2.0.0a (WAR distribution), PostgreSQL 8.4.1, PostGIS 1.3.5, Sun JDK 1.6.0, Ubuntu Linux 9.10
    • Number of attachments :
      0

      Description

      We are trying to upgrade our GeoServer 1.7.6 installation to 2.0.0, but GeoServer fails to identify the native SRS for our database. The result is that on the layer creation page the "Native SRS" field stays empty and the layer will not be rendered in the preview.

      Turning verbose logging on results in this SQL query being shown:

      SELECT "id","area_type",encode(asBinary(force_2d("the_geom"),'XDR'),'base64') as "the_geom" FROM "public"."areas_in_time" WHERE ("the_geom" && GeomFromText('POLYGON ((150.68856835939002 -29.56075390625, 150.68856835939002 -24.804246093750002, 154.51043164064 -24.804246093750002, 154.51043164064 -29.56075390625, 150.68856835939002 -29.56075390625))', null) AND ("area_type" = 'bay area' OR "area_type" = 'catchment'))

      which returns an empty result set due to the "null" value for the SRS – it works fine if I replace the "null" with the expected "4326".

      If I try to change the handling of SRS to "Reproject Native to Declared", I get this stacktrace:

      org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer [Component id = resource]] threw an exception
      at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
      at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
      at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
      at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1239)
      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316)
      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418)
      at org.apache.wicket.RequestCycle.request(RequestCycle.java:532)
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:356)
      at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:145)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158)
      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:875)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
      at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
      at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
      at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
      at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
      at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
      at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
      at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
      at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
      at java.lang.Thread.run(Thread.java:636)
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183)
      ... 131 more
      Caused by: java.lang.IllegalArgumentException: Argument "sourceCRS" should not be null.
      at org.geotools.referencing.operation.AbstractCoordinateOperationFactory.ensureNonNull(AbstractCoordinateOperationFactory.java:732)
      at org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:247)
      at org.geotools.referencing.CRS.findMathTransform(CRS.java:1026)
      at org.geoserver.web.data.resource.BasicResourceConfig$ReprojectionIsPossibleValidator.validate(BasicResourceConfig.java:225)
      at org.apache.wicket.markup.html.form.Form.validateFormValidator(Form.java:1976)
      at org.apache.wicket.markup.html.form.Form.validateFormValidators(Form.java:1988)
      at org.apache.wicket.markup.html.form.Form$23.component(Form.java:2007)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:830)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:845)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:845)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:845)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:845)
      at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:845)
      at org.apache.wicket.markup.html.form.Form.validateNestedForms(Form.java:1999)
      at org.apache.wicket.markup.html.form.Form.validate(Form.java:1888)
      at org.apache.wicket.markup.html.form.Form.process(Form.java:846)
      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808)
      ... 135 more

      [BTW: copying that from the website is useless due to missing linebreaks, this comes from the log file]

      Changing it to "Keep Native" just quietly fails to work – saving the change and going back in I still see the "Force Declared" and I can't see any error message in the UI or in the log (with verbose logging enabled). That might be a separate issue.

        Issue Links

          Activity

          Hide
          Peter Becker added a comment -

          I just tried the current nightly (as of 2009-11-30) and that doesn't have this issue any more: the native SRS is recognized when I create the layers.

          Show
          Peter Becker added a comment - I just tried the current nightly (as of 2009-11-30) and that doesn't have this issue any more: the native SRS is recognized when I create the layers.
          Hide
          Andrea Aime added a comment -

          That's because we re-enabled an heuristics that picks the SRS of the first geometry if there is no declaration in geometry_columns. Mind it's bad practice not to declare geometry metadata, you really should adopt that practice for both tables and views.

          Show
          Andrea Aime added a comment - That's because we re-enabled an heuristics that picks the SRS of the first geometry if there is no declaration in geometry_columns. Mind it's bad practice not to declare geometry metadata, you really should adopt that practice for both tables and views.
          Hide
          Peter Becker added a comment -

          I'm not sure what you mean with "no declaration in geometry_columns", but ours looks like this:

          ehmp=> select * from geometry_columns;
           f_table_catalog | f_table_schema |   f_table_name   | f_geometry_column | coord_dimension | srid |      type
          -----------------+----------------+------------------+-------------------+-----------------+------+-----------------
                           | public         | catchments       | the_geom          |               2 | 4326 | MULTIPOLYGON
                           | public         | bay_areas        | the_geom          |               2 | 4326 | MULTIPOLYGON
                           | public         | estuaries        | the_geom          |               2 | 4326 | MULTILINESTRING
                           | public         | eprapah_ck       | the_geom          |               2 | 4326 | MULTILINESTRING
                           | public         | sites            | the_geom          |               2 | 4326 | POINT
                           | public         | freshwater_sites | the_geom          |               2 | 4326 | POINT
                           | public         | areas            | the_geom          |               2 | 4326 | MULTIPOLYGON
                           | public         | estuaries_simple | the_geom          |               2 | 4326 | LINESTRING
          (8 rows)
          

          Is there anything else we should declare?

          Show
          Peter Becker added a comment - I'm not sure what you mean with "no declaration in geometry_columns", but ours looks like this: ehmp=> select * from geometry_columns; f_table_catalog | f_table_schema | f_table_name | f_geometry_column | coord_dimension | srid | type -----------------+----------------+------------------+-------------------+-----------------+------+----------------- | public | catchments | the_geom | 2 | 4326 | MULTIPOLYGON | public | bay_areas | the_geom | 2 | 4326 | MULTIPOLYGON | public | estuaries | the_geom | 2 | 4326 | MULTILINESTRING | public | eprapah_ck | the_geom | 2 | 4326 | MULTILINESTRING | public | sites | the_geom | 2 | 4326 | POINT | public | freshwater_sites | the_geom | 2 | 4326 | POINT | public | areas | the_geom | 2 | 4326 | MULTIPOLYGON | public | estuaries_simple | the_geom | 2 | 4326 | LINESTRING (8 rows) Is there anything else we should declare?
          Hide
          Andrea Aime added a comment -

          Well, I don't see "areas_in_time" in that table. You should declare views also for GeoServer to determine their srid and geometry type.
          Or use a nightly build from:
          http://gridlock.openplans.org/geoserver/2.0.x/

          that, as I said, has the "first row" heuristic back.

          Show
          Andrea Aime added a comment - Well, I don't see "areas_in_time" in that table. You should declare views also for GeoServer to determine their srid and geometry type. Or use a nightly build from: http://gridlock.openplans.org/geoserver/2.0.x/ that, as I said, has the "first row" heuristic back.
          Hide
          Peter Becker added a comment -

          Andrea: you are right, we lacked the metadata on those tables (they are materialized views). I didn't even notice.

          I fixed that, but I won't bother downgrading again. As stated before: the nightly builds work for us even before we added the extra metadata. I'm happy to assume with the fixed columns it will work in the published 2.0 versions, and I suspect it won't matter anymore at the time we go public again. Until then nightlies are ok.

          Thanks.

          Show
          Peter Becker added a comment - Andrea: you are right, we lacked the metadata on those tables (they are materialized views). I didn't even notice. I fixed that, but I won't bother downgrading again. As stated before: the nightly builds work for us even before we added the extra metadata. I'm happy to assume with the fixed columns it will work in the published 2.0 versions, and I suspect it won't matter anymore at the time we go public again. Until then nightlies are ok. Thanks.

            People

            • Assignee:
              Andrea Aime
              Reporter:
              Peter Becker
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: