deegree / deegree3

Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
https://www.deegree.org
GNU Lesser General Public License v2.1
146 stars 100 forks source link

Removing bbox_cache.properties causes NPE #825

Closed lgoltz closed 9 months ago

lgoltz commented 7 years ago

Removing the bbox_cache.properties file causes to NullPointerExceptions in some cases. We observed two different NPEs:

  1. NPE during reload If the bbox_cache.properties file is removed during deegree is running layers cannot be initialised after a workspace reload. The layers with errors during insert are vector layers with SQLFeatureStore and does not contain data.

Stacktrace:

[12:24:10] ERROR: [DefaultWorkspace] Unable to build resource LayerStoreProvider:fplan: Could not parse layer configuration file: null
org.deegree.workspace.ResourceInitException: Unable to build resource LayerStoreProvider:fplan: Could not parse layer configuration file: null
    at org.deegree.workspace.standard.DefaultWorkspace.init(DefaultWorkspace.java:397)
    at org.deegree.workspace.WorkspaceUtils.reinitializeChain(WorkspaceUtils.java:89)
    at org.deegree.console.Config.activate(Config.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:245)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:277)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
[12:24:27] Dirk Stenger: Caused by: org.deegree.workspace.ResourceInitException: Could not parse layer configuration file: null
    at org.deegree.layer.persistence.feature.FeatureLayerStoreBuilder.build(FeatureLayerStoreBuilder.java:85)
    at org.deegree.layer.persistence.feature.FeatureLayerStoreBuilder.build(FeatureLayerStoreBuilder.java:49)
    at org.deegree.workspace.standard.DefaultWorkspace.init(DefaultWorkspace.java:379)
    ... 44 more
Caused by: java.lang.NullPointerException
    at org.deegree.layer.persistence.feature.LayerMetadataBuilder.buildMetadata(LayerMetadataBuilder.java:107)
    at org.deegree.layer.persistence.feature.ManualFeatureLayerBuilder.buildFeatureLayers(ManualFeatureLayerBuilder.java:116)
    at org.deegree.layer.persistence.feature.FeatureLayerStoreBuilder.build(FeatureLayerStoreBuilder.java:83)
    ... 46 more
  1. NPE during insert This also requires that the store is empty. Steps to reproduce:
    • remove bbox_cache.properties
    • Reload Workspace
    • GetCapabilities with POST (this seems to be important)
    • Insert (stacktrace below)

The error only occurs if the last two steps are executed one after another with less than a few seconds between.

Stacktrace:

deegree3  | java.lang.NullPointerException
deegree3  |     at org.deegree.feature.persistence.cache.BBoxPropertiesCache.encodePropValue(BBoxPropertiesCache.java:197)
deegree3  |     at org.deegree.feature.persistence.cache.BBoxPropertiesCache.persist(BBoxPropertiesCache.java:149)
deegree3  |     at org.deegree.feature.persistence.cache.BBoxPropertiesCache.set(BBoxPropertiesCache.java:137)
deegree3  |     at org.deegree.feature.persistence.sql.SQLFeatureStoreTransaction.updateBBoxCache(SQLFeatureStoreTransaction.java:213)
deegree3  |     at org.deegree.feature.persistence.sql.SQLFeatureStoreTransaction.commit(SQLFeatureStoreTransaction.java:183)
deegree3  |     at org.deegree.services.wfs.TransactionHandler.doTransaction(TransactionHandler.java:264)
deegree3  |     at org.deegree.services.wfs.WebFeatureService.doXML(WebFeatureService.java:983)
deegree3  |     at org.deegree.services.controller.OGCFrontController.dispatchXMLRequest(OGCFrontController.java:895)
deegree3  |     at org.deegree.services.controller.OGCFrontController.doPost(OGCFrontController.java:502)
deegree3  |     at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
julianzz98 commented 9 months ago

The following tests were conducted using deegree 3.5.0:

  1. Locally deployed deegree 3.5.0
  2. Start workspace with database connection, wms and layers (database is empty)
  3. Removed bbox_cache.properties
  4. Reloaded workspace

The following output is given by the logs:

2023-12-01 17:11:22,856 INFO o.d.f.p.c.BBoxPropertiesCache [http-nio-8080-exec-8] File '/root/.deegree/xplansyn-wms-workspace/datasources/feature/bbox_cache.properties' does not exist. Will be created as needed.

The workspace reload was successful and a new bbox_cache.properties was created (could be from PR #1477).

Therefore I am considering this issue obsolete and close it.