EventStore & RavenDB Persistence JsonReaderException

本文关键字:Persistence JsonReaderException RavenDB amp EventStore | 更新日期: 2023-09-27 18:33:09

试图将JOliver的EventStore与RavenDB连接起来并遇到了障碍。我在Raven中创建了一个名为RavenEventStore的新数据库。

以下是我的线路;

return Wireup.Init()
           .UsingRavenPersistence("RavenEventStore")
             .UsingAsynchronousDispatchScheduler()
                .DispatchTo(new DelegateMessageDispatcher(DispatchCommit))
           .Build();

当调用 Wireup.Init(( 时,此异常发生在 RavenDb 端;

url: "/indexes/RavenCommitByDate" Newtonsoft.Json.JsonReaderException: 解析值时遇到意外字符: .第 1 行,位置 1。 at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar( in d:''Development''Releases''Json''Working''Src''Newtonsoft.Json''JsonTextReader.cs:line 699 at Newtonsoft.Json.JsonTextReader.ReadInternal(( in d:''Development''Releases''Json''Working''Src''Newtonsoft.Json''JsonTextReader.cs:line 499 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, Type t, JsonConverter propertyConverter( in d:''Development''Releases''Json''Working''Src''Newtonsoft.Json''Serialization''JsonSerializerInternalReader.cs:line 1072 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType( in d:''Development''Releases''Json''Working''Src''Newtonsoft.Json''Serialization''JsonSerializerInternalReader.cs:line 118 at Raven.Database.Extensions.HttpExtensions.ReadJsonObject[T](IHttpContext context( in c:''Builds''raven''Raven.Database''Extensions''HttpExtensions.cs:line 57 at Raven.Database.Server.Responders.Index.Put(IHttpContext context, String index( in c:''Builds''raven''Raven.Database''Server''Responders''Index.cs:line 64 at Raven.Database.Server.Responders.Index.Respond(IHttpContext context( in c:''Builds''raven''Raven.Database''Server''Responders''Index.cs:line 49 at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx( in c:''Builds''raven''Raven.Database''Server''HttpServer.cs:line 477 at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx( in c:''Builds''raven''Raven.Database''Server''HttpServer.cs:line 259

我也可以在 RavenDB 日志中看到异常;

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Line 1, position 1.   at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar) in d:'Development'Releases'Json'Working'Src'Newtonsoft.Json'JsonTextReader.cs:line 699 at Newtonsoft.Json.JsonTextReader.ReadInternal() in d:'Development'Releases'Json'Working'Src'Newtonsoft.Json'JsonTextReader.cs:line 499 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, Type t, JsonConverter propertyConverter) in d:'Development'Releases'Json'Working'Src'Newtonsoft.Json'Serialization'JsonSerializerInternalReader.cs:line 1072 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) in d:'Development'Releases'Json'Working'Src'Newtonsoft.Json'Serialization'JsonSerializerInternalReader.cs:line 118 at Raven.Database.Extensions.HttpExtensions.ReadJsonObject[T](IHttpContext context) in c:'Builds'raven'Raven.Database'Extensions'HttpExtensions.cs:line 57 at Raven.Database.Server.Responders.Index.Put(IHttpContext context, String index) in c:'Builds'raven'Raven.Database'Server'Responders'Index.cs:line 64 at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:'Builds'raven'Raven.Database'Server'Responders'Index.cs:line 49 at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:'Builds'raven'Raven.Database'Server'HttpServer.cs:line 477 at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:'Builds'raven'Raven.Database'Server'HttpServer.cs:line 259

我试图通过删除UsingAsyncDispatchScheduler((方法来消除所有可能性,并导致相同的错误。我使用的代码严格来自此处的示例:https://github.com/joliver/EventStore/blob/master/doc/EventStore.Example/MainProgram.cs

有人经历过吗?在谷歌上也找不到任何东西。

EventStore & RavenDB Persistence JsonReaderException

Ryan,您正在使用较旧的服务器(888 之前(和新客户端(888 或更高版本(

您的问题可能与此类似:事件存储 + RavenDB,反序列化不正确

此外,我肯定会建议按照 Oren 的建议对 Raven build 888(或更高版本(使用自定义版本,直到我可以针对较新版本的 Raven 发布新版本。