[ 
https://issues.apache.org/jira/browse/GEODE-8235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Blum updated GEODE-8235:
-----------------------------
    Description: 
As application developer using Apache Geode, if I create a {{ClientCache}} 
application that contains client {{LOCAL}} (only) Regions (i.e. with 
{{ClientRegionShortcut.LOCAL}} and I attempt to store objects in PDX serialized 
form, then Geode will throw an Exception:

ACTUAL:

{code}
Caused by: org.apache.geode.pdx.JSONFormatterException: Could not parse JSON 
document: [Source: 
(String)"{"@type":"example.app.model.Customer","id":1,"name":"Jon Doe"}"; line: 
1, column: 63]
        at 
org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:206) 
~[geode-core-1.12.0.jar:na]
        at org.apache.geode.pdx.JSONFormatter.fromJSON(JSONFormatter.java:134) 
~[geode-core-1.12.0.jar:na]
        at ...
        ... 39 common frames omitted
Caused by: org.apache.geode.cache.CacheClosedException: Client pools have been 
closed so the PDX type registry is not available.
        at 
org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1630)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1619)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.ClientTypeRegistration.getAllPools(ClientTypeRegistration.java:153)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.ClientTypeRegistration.defineType(ClientTypeRegistration.java:63)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.TypeRegistry.defineType(TypeRegistry.java:202) 
~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.TypeRegistry.defineLocalType(TypeRegistry.java:250)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.PdxWriterImpl.completeByteStreamGeneration(PdxWriterImpl.java:540)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.PdxInstanceFactoryImpl.create(PdxInstanceFactoryImpl.java:64)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.json.PdxInstanceHelper.endObjectField(PdxInstanceHelper.java:209)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.JSONFormatter.getPdxInstance(JSONFormatter.java:309) 
~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:199) 
~[geode-core-1.12.0.jar:na]
        ... 55 common frames omitted
{code}

First of all this is not even an appropriate Exception!  
{{CacheCloseException}} because my client had no open Pools to an available 
server with a PDX type registry.

1. Creating client local-only applications not connected to an entire cluster 
or server is a very useful and practical arrangement during development.

2. My application should not have to be a peer {{Cache}} to have an available 
PDX type registry to store PDX instances in client {{LOCAL}} Regions.

3. It is actually highly useful to run my application in local-only mode, in a 
local-only context (i.e. with only client {{LOCAL}} Regions) without a cluster 
or server for development, testing and debugging purposes.

4. It is also really useful if my application can also store PDX bytes, even in 
client {{LOCAL}} (only) Regions for development, testing and debugging purposes.

Some find it hard to imagine why an application would want to do this, store 
PDX instead of POJOs.  However, consider the fact that my application might be 
part of a larger Microservices architecture that communicate via a RESTful 
interfaces.  They pass JSON back and forth, which might either be complex or 
unstructured.  Either way, it is possible I don't have or don't want to create 
POJOs (types) matching the JSON that my Microservice consumes.  I simply want 
access to certain bits of information which PDX is adequately suited for.  
These client LOCAL Regions might even be temporary.  When connected, I might 
even want to share this data (or aggregated data) with Native Clients which 
most certainly won't have Java types matching the JSON content, raw or 
summarized.

EXPECTED:

As a developer using Apache Geode, I expected to be able to develop (primarily) 
{{ClientCache}} applications, run them locally with client {{LOCAL}} Regions, 
storing data in PDX format as necessary, all without requiring a complex setup 
(e.g. such as a cluster or a server).


  was:
As application developer using Apache Geode, if I create a {{ClientCache}} 
application that contains client {{LOCAL}} (only) Regions (i.e. with 
{{ClientRegionShortcut.LOCAL}} and I attempt to store objects in PDX serialized 
form, then Geode will throw an Exception:

{code}
Caused by: org.apache.geode.pdx.JSONFormatterException: Could not parse JSON 
document: [Source: 
(String)"{"@type":"example.app.model.Customer","id":1,"name":"Jon Doe"}"; line: 
1, column: 63]
        at 
org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:206) 
~[geode-core-1.12.0.jar:na]
        at org.apache.geode.pdx.JSONFormatter.fromJSON(JSONFormatter.java:134) 
~[geode-core-1.12.0.jar:na]
        at ...
        ... 39 common frames omitted
Caused by: org.apache.geode.cache.CacheClosedException: Client pools have been 
closed so the PDX type registry is not available.
        at 
org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1630)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1619)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.ClientTypeRegistration.getAllPools(ClientTypeRegistration.java:153)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.ClientTypeRegistration.defineType(ClientTypeRegistration.java:63)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.TypeRegistry.defineType(TypeRegistry.java:202) 
~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.TypeRegistry.defineLocalType(TypeRegistry.java:250)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.PdxWriterImpl.completeByteStreamGeneration(PdxWriterImpl.java:540)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.PdxInstanceFactoryImpl.create(PdxInstanceFactoryImpl.java:64)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.internal.json.PdxInstanceHelper.endObjectField(PdxInstanceHelper.java:209)
 ~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.JSONFormatter.getPdxInstance(JSONFormatter.java:309) 
~[geode-core-1.12.0.jar:na]
        at 
org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:199) 
~[geode-core-1.12.0.jar:na]
        ... 55 common frames omitted
{code}

First of all this is not even an appropriate Exception!  
{{CacheCloseException}} because my client had no open Pools to an available 
server with a PDX type registry.

1. Creating client local-only applications not connected to an entire cluster 
or server is a very useful and practical arrangement during development.

2. My application should not have to be a peer {{Cache}} to have an available 
PDX type registry to store PDX instances in client {{LOCAL}} Regions.

3. It is actually highly useful to run my application in local-only mode, in a 
local-only context (i.e. with only client {{LOCAL}} Regions) without a cluster 
or server for development, testing and debugging purposes.

4. It is also really useful if my application can also store PDX bytes, even in 
client {{LOCAL}} (only) Regions for development, testing and debugging purposes.

Some find it hard to imagine why an application would want to do this, store 
PDX instead of POJOs.  However, consider the fact that my application might be 
part of a larger Microservices architecture that communicate via a RESTful 
interfaces.  They pass JSON back and forth, which might either be complex or 
unstructured.  Either way, it is possible I don't have or don't want to create 
POJOs (types) matching the JSON that my Microservice consumes.  I simply want 
access to certain bits of information which PDX is adequately suited for.  
These client LOCAL Regions might even be temporary.  When connected, I might 
even want to share this data (or aggregated data) with Native Clients which 
most certainly won't have Java types matching the JSON content, raw or 
summarized.




> Server should not be required to have available a PDX type registry in 
> ClientCache applications
> -----------------------------------------------------------------------------------------------
>
>                 Key: GEODE-8235
>                 URL: https://issues.apache.org/jira/browse/GEODE-8235
>             Project: Geode
>          Issue Type: Bug
>          Components: serialization
>            Reporter: John Blum
>            Priority: Major
>
> As application developer using Apache Geode, if I create a {{ClientCache}} 
> application that contains client {{LOCAL}} (only) Regions (i.e. with 
> {{ClientRegionShortcut.LOCAL}} and I attempt to store objects in PDX 
> serialized form, then Geode will throw an Exception:
> ACTUAL:
> {code}
> Caused by: org.apache.geode.pdx.JSONFormatterException: Could not parse JSON 
> document: [Source: 
> (String)"{"@type":"example.app.model.Customer","id":1,"name":"Jon Doe"}"; 
> line: 1, column: 63]
>       at 
> org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:206) 
> ~[geode-core-1.12.0.jar:na]
>       at org.apache.geode.pdx.JSONFormatter.fromJSON(JSONFormatter.java:134) 
> ~[geode-core-1.12.0.jar:na]
>       at ...
>       ... 39 common frames omitted
> Caused by: org.apache.geode.cache.CacheClosedException: Client pools have 
> been closed so the PDX type registry is not available.
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1630)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.internal.cache.GemFireCacheImpl.getCacheClosedException(GemFireCacheImpl.java:1619)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.ClientTypeRegistration.getAllPools(ClientTypeRegistration.java:153)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.ClientTypeRegistration.defineType(ClientTypeRegistration.java:63)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.TypeRegistry.defineType(TypeRegistry.java:202) 
> ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.TypeRegistry.defineLocalType(TypeRegistry.java:250)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.PdxWriterImpl.completeByteStreamGeneration(PdxWriterImpl.java:540)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.PdxInstanceFactoryImpl.create(PdxInstanceFactoryImpl.java:64)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.internal.json.PdxInstanceHelper.endObjectField(PdxInstanceHelper.java:209)
>  ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.JSONFormatter.getPdxInstance(JSONFormatter.java:309) 
> ~[geode-core-1.12.0.jar:na]
>       at 
> org.apache.geode.pdx.JSONFormatter.toPdxInstance(JSONFormatter.java:199) 
> ~[geode-core-1.12.0.jar:na]
>       ... 55 common frames omitted
> {code}
> First of all this is not even an appropriate Exception!  
> {{CacheCloseException}} because my client had no open Pools to an available 
> server with a PDX type registry.
> 1. Creating client local-only applications not connected to an entire cluster 
> or server is a very useful and practical arrangement during development.
> 2. My application should not have to be a peer {{Cache}} to have an available 
> PDX type registry to store PDX instances in client {{LOCAL}} Regions.
> 3. It is actually highly useful to run my application in local-only mode, in 
> a local-only context (i.e. with only client {{LOCAL}} Regions) without a 
> cluster or server for development, testing and debugging purposes.
> 4. It is also really useful if my application can also store PDX bytes, even 
> in client {{LOCAL}} (only) Regions for development, testing and debugging 
> purposes.
> Some find it hard to imagine why an application would want to do this, store 
> PDX instead of POJOs.  However, consider the fact that my application might 
> be part of a larger Microservices architecture that communicate via a RESTful 
> interfaces.  They pass JSON back and forth, which might either be complex or 
> unstructured.  Either way, it is possible I don't have or don't want to 
> create POJOs (types) matching the JSON that my Microservice consumes.  I 
> simply want access to certain bits of information which PDX is adequately 
> suited for.  These client LOCAL Regions might even be temporary.  When 
> connected, I might even want to share this data (or aggregated data) with 
> Native Clients which most certainly won't have Java types matching the JSON 
> content, raw or summarized.
> EXPECTED:
> As a developer using Apache Geode, I expected to be able to develop 
> (primarily) {{ClientCache}} applications, run them locally with client 
> {{LOCAL}} Regions, storing data in PDX format as necessary, all without 
> requiring a complex setup (e.g. such as a cluster or a server).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to