0

I want to change the datastore, from oracle to postgres. I have installed the 2.8-SNAPSHOT version

I did perform a curl PUT request to change it

curl -u user:pass -X PUT  http://localhost:8080/geoserver/rest/workspaces/MYWorkspace/datastores/MyDataStore -H  "accept: application/json" -H  "content-type: application/xml" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><dataStore>\t<name>MyDataStore</name>\t<type>PostGIS</type>\t<enabled>true</enabled>\t<workspace>\t  <name>MYWorkspace</name>\t</workspace>\t<connectionParameters>\t\t<host>myhost</host>\t\t<port>5432</port>\t\t<database>mydb</database>\t\t<user>postgres</user>\t\t<passwd>postgres</passwd>\t\t<schema>myschema</schema><dbtype>postgis</dbtype>\t\t</connectionParameters>\t<__default>false</__default></dataStore>

Pretty printed payload for easier reading:

<?xml version="1.0" encoding="UTF-8"?>
<dataStore>
  <name>MyDataStore</name>
  <type>PostGIS</type>
  <enabled>true</enabled>
  <workspace>
    <name>MYWorkspace</name>
  </workspace>
  <connectionParameters>
    <host>myhost</host>
    <port>5432</port>
    <database>mydb</database>
    <user>postgres</user>
    <passwd>postgres</passwd>
    <schema>myschema</schema>
    <dbtype>postgis</dbtype>
  </connectionParameters>
  <__default>false</__default>
</dataStore>

The curl petition returned nothing; but I do see the changes in the datastore.xml file

But, when I enter into the datastore in geoserver, I get this error:

org.apache.wicket.WicketRuntimeException: Error attaching this container for
rendering: [MarkupContainer [Component id = parametersPanel]] at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1765)
at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at
org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at
org.apache.wicket.Component.beforeRender(Component.java:1105) at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753)
at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at
org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:2056) at
org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at
org.apache.wicket.Component.beforeRender(Component.java:1105) at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753)
at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at
org.apache.wicket.Page.onBeforeRender(Page.java:1531) at
org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at
org.apache.wicket.Component.beforeRender(Component.java:1105) at
org.apache.wicket.Component.prepareForRender(Component.java:2292) at
org.apache.wicket.Page.prepareForRender(Page.java:1521) at
org.apache.wicket.Component.prepareForRender(Component.java:2329) at
org.apache.wicket.Page.renderPage(Page.java:892) at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at
org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at
org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484) at
org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at
org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:156)
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:919)
at com.boundlessgeo.geoserver.AppDispatcher.doDispatch(AppDispatcher.java:67) at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:654) at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1320)
at
org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
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 com.boundlessgeo.geoserver.AppAuthFilter.doFilter(AppAuthFilter.java:111) at
org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71)
at
org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:46)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at
org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:50)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
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:342)
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:342)
at
org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:54)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
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.GeoServerUserNamePasswordAuthenticationFilter.doFilter(GeoServerUserNamePasswordAuthenticationFilter.java:116)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
at
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
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:342)
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:342)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at
org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:135)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:87) at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42) at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:48)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:44) at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:443) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:532) at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372) at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:369) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486)
at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:933)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:995)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source) Caused by:
java.lang.NullPointerException at
org.geoserver.catalog.impl.DefaultCatalogFacade.getNamespaceByURI(DefaultCatalogFacade.java:678)
at
org.geoserver.catalog.impl.CatalogImpl.getNamespaceByURI(CatalogImpl.java:1054)
at
org.geoserver.security.SecureCatalogImpl.getNamespaceByURI(SecureCatalogImpl.java:360)

Am I missing something?

2

In addition to Ian's valid points, I'll add that the XML does not seem like the one GeoServer would use/generate to describe a store, which looks as follows instead:

<?xml version="1.0"?>
<dataStore>
  <name>gtttest</name>
  <type>PostGIS</type>
  <enabled>true</enabled>
  <workspace>
    <name>importer</name>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/importer.xml" type="application/xml"/>
  </workspace>
  <connectionParameters>
    <entry key="schema">public</entry>
    <entry key="Evictor run periodicity">300</entry>
    <entry key="Max open prepared statements">50</entry>
    <entry key="encode functions">false</entry>
    <entry key="Batch insert size">1</entry>
    <entry key="preparedStatements">false</entry>
    <entry key="database">gttest</entry>
    <entry key="host">localhost</entry>
    <entry key="Loose bbox">true</entry>
    <entry key="Estimated extends">true</entry>
    <entry key="fetch size">1000</entry>
    <entry key="Expose primary keys">false</entry>
    <entry key="validate connections">true</entry>
    <entry key="Support on the fly geometry simplification">true</entry>
    <entry key="Connection timeout">20</entry>
    <entry key="create database">false</entry>
    <entry key="port">5432</entry>
    <entry key="passwd">pwd</entry>
    <entry key="min connections">1</entry>
    <entry key="dbtype">postgis</entry>
    <entry key="namespace">http://geoserver.org/importer</entry>
    <entry key="max connections">10</entry>
    <entry key="Evictor tests per run">3</entry>
    <entry key="Test while idle">true</entry>
    <entry key="user">user</entry>
    <entry key="Max connection idle time">300</entry>
  </connectionParameters>
  <__default>false</__default>
  <featureTypes>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/importer/datastores/gtttest/featuretypes.xml" type="application/xml"/>
  </featureTypes>
</dataStore>
1

To start with don't use GeoServer 2.8-SNAPSHOT, the current stable version is 2.13.1. Unless you have an enormous number of these stores to change I would just use the GUI rather than REST or at least for the first one.

I suspect all sorts of things can go wrong switching a datastore type, most likely is that the table names have changed (Oracle and PostGIS have very different ideas as to table (and column) names).

2
  • the table names are the same, it only changed the convention (In oracle there is uppercase name, in postgres the opposite)
    – Naty Bizz
    Jun 6 '18 at 14:43
  • 1
    if you changed the case then they are not the same at all and I would expect this to fail.
    – Ian Turton
    Jun 6 '18 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.