6 Replies Latest reply on Jan 1, 2009 1:41 PM by Mfalco-Oracle

    Storing large DateTime values from .NET

      Our system uses 1/1/9999 as a NULL value for DateTime fields. When processing data in Java, the data is properly serialized as Timestamp data type. However, when accessing the grid from .NET Application, and trying to store the DateTime value into the grid via POF, I get an exception (Invalid Date)

      Any pointers on resolving the issue?

      Thank you


      Edited by: Timur on Dec 30, 2008 11:53 AM
        • 1. Re: Storing large DateTime values from .NET
          Hi Timur,

          Would it be possible for you to post:

          (1) a stack trace
          (2) .NET and Java code for their POF data types
          (3) configuration files (cache, POF) for java and .net

          Also some further clarifications could possibly be helpful:

          Are the working serialization in Java and the "broken" one in .NET via POF are 2 different caches/tests?

          Where is the exception happening (and what is it) is it in POFing the .NET DateTime object?
          or is it de-POFing it on the server side?

          Why are you not just using null for DateTime fields instead of a special date?


          -David Leibs
          • 2. Re: Storing large DateTime values from .NET
            I've modified the original post: the DateTime is actually stored as Timestamp (to be able to store the SQL millisecond value)

            The StackTrace from .NET is:

            2057573 System.Exception: Exception of type 'System.Exception' was thrown. ---> Portable(java.lang.IllegalStateException): year is likely out of range: 9999
            --- End of inner exception stack trace ---
            at Tangosol.Net.Messaging.Impl.Request.RequestStatus.get_Response() in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Messaging\Impl\Request.cs:line 365
            at Tangosol.Net.Messaging.Impl.Request.RequestStatus.WaitForResponse(Int64 millis) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Messaging\Impl\Request.cs:line 605
            at Tangosol.Net.Messaging.Impl.Channel.Request(IRequest request, Int64 millis) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Messaging\Impl\Channel.cs:line 1272
            at Tangosol.Net.Messaging.Impl.Channel.Request(IRequest request) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Messaging\Impl\Channel.cs:line 1233
            at Tangosol.Net.Impl.RemoteNamedCache.BinaryNamedCache.Contains(Object key) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Impl\RemoteNamedCache.cs:line 2774
            at Tangosol.Util.ConverterCollections.ConverterDictionary.Contains(Object key) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Util\ConverterCollections.cs:line 1149
            at Tangosol.Net.Impl.RemoteNamedCache.Contains(Object key) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Impl\RemoteNamedCache.cs:line 420
            at Tangosol.Net.Impl.SafeNamedCache.Contains(Object key) in c:\dev\release.net\coherence-net-v3.4\src\Coherence\Net\Impl\SafeNamedCache.cs:line 327
            at CacheDirect.CoherenceSubscriber.ProcessOrders(IEnumerable`1 orders) in d:\bamboo\build-dir\TRITON-ASTRUNK\.Net\Server\AggregationSubscribers\CacheDirect\CoherenceSubscriber.cs:line 146
            Void ThreadStart_Context(System.Object) at
            Void runTryCode(System.Object) at
            Void ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object) at
            Void RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at
            Void Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at
            Void ThreadStart(System.Object) at

            The last line of our code is:
            if (!ordersCache.Contains(key))

            Edited by: Timur on Dec 30, 2008 12:35 PM
            • 3. Re: Storing large DateTime values from .NET
              Hi Timur,
              I am guessing that your are only using POF for .NET and not Java as I found where the Java POF code throws the IllegalStteException you are seeing. It seems that we will be extremely strict for purposes of identifying potential problems and checking dates to be between 1582 and 2199.

              I will initiate an conversation concerning the relaxing strictness but for now you may want to use "null" for your DateTime which I believe would be better than changing to "1/1/2199".

              Please let us know what you do,
              • 4. Re: Storing large DateTime values from .NET
                We are actually using both. With .NET Client submits data to the grid, and executes Processors that are executed in the grid fabric on each object. We get exceptions in both (attached). From the exception, it seems to me that the grid was able to store the POF version of the object since it was sent via .NET, but is unable to do any server side processing on it.

                Changing values to NULL is problematic, as there are other processes already in production that utilize the data and rely on 1/1/9999 value

                Oracle Coherence GE 3.4/405p1 <Error> (thread=Proxy:ExtendTcpProxyService:TcpAcceptor, member=8): An exception occurred while decoding a Message for Service=Proxy:ExtendTcpProxyService:TcpAcceptor received from: TcpConnection(Id=0x0000011E63E34C7AAC13549742706CFBD691A63F1C181127CEFBFC372FB17A4A, Open=true, LocalAddress=, RemoteAddress= java.lang.IllegalStateException: year is likely out of range: 9999
                     at com.tangosol.io.pof.PofHelper.checkDate(PofHelper.java:1526)
                     at com.tangosol.io.pof.RawDate.<init>(RawDate.java:35)
                     at com.tangosol.io.pof.PofHelper.readRawDate(PofHelper.java:516)
                     at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:2865)
                     at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2599)
                     at com.tangosol.util.processor.UpdaterProcessor.readExternal(UpdaterProcessor.java:186)
                     at com.tangosol.io.pof.PortableObjectSerializer.initialize(PortableObjectSerializer.java:153)
                     at com.tangosol.io.pof.PortableObjectSerializer.deserialize(PortableObjectSerializer.java:128)
                     at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3284)
                     at com.tangosol.io.pof.PofBufferReader.readAsObjectArray(PofBufferReader.java:3328)
                     at com.tangosol.io.pof.PofBufferReader.readObjectArray(PofBufferReader.java:2168)
                     at com.tangosol.util.processor.CompositeProcessor.readExternal(CompositeProcessor.java:169)
                     at com.tangosol.io.pof.PortableObjectSerializer.initialize(PortableObjectSerializer.java:153)
                     at com.tangosol.io.pof.PortableObjectSerializer.deserialize(PortableObjectSerializer.java:128)
                     at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3284)
                     at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2599)
                     at com.tangosol.coherence.component.net.extend.messageFactory.NamedCacheFactory$InvokeRequest.readExternal(NamedCacheFactory.CDB:5)
                     at com.tangosol.coherence.component.net.extend.Codec.decode(Codec.CDB:29)
                     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.decodeMessage(Peer.CDB:25)
                     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.onNotify(Peer.CDB:47)
                     at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:37)
                     at java.lang.Thread.run(Thread.java:595)
                • 5. Re: Storing large DateTime values from .NET
                  Hi Timur,
                  Since you can't use null then you should write and read the individual numbers for the month, day, and year in your readExternal and writeExternal methods.

                  Another possibility would be to create custom PofSerializer for the Date class that serializes the "special" date as null and deserializes a null date as the "special" date.

                  See the "Making Types Portable Without Modification" section of:

                  for the details


                  Edited by: dleibs on Dec 31, 2008 9:58 AM
                  • 6. Re: Storing large DateTime values from .NET
                    You may want to consider transporting your special value 1/1/9999 as null on the wire by simply testing and converting during serialization and then back to 1/1/9999 during deserialization. This will have no impact on application logic and also be very compact on the wire.

                    Happy Null Year ;)