Closed chester89 closed 10 years ago
Forgot to mention - I'm using NodaTime 1.2.0 for my project and I copied it to the /Plugins folder of RavenDb
I assume you are running RavenDB as a server, not as embedded mode. Correct?
Are you using NodaTime in your RavenDB indexes? If not, you don't need the bundle.
Also, could you please paste a copy of the exception so I can see the exact error? Please include the stack trace if there is one. Thanks.
Well, I run it in embedded mode - I installed the RavenDb.Server NuGet package and I just launch Raven.Server.exe every time I want to do something. No, I don't use NodaTime in RavenDb indexes - that's because I only did the storage for now, but I will likely use indexes when I get to the reading part of the app. I got what you're saying. There's no stacktrace as such - it just says "Couldn't load file or assembly NodaTime 1.1.0 or one of its dependencies". It seems strange that the problem is present when trying to open RavenDb studio. I hadn't tried to write data into the db and read it back without opening the studio - will do later today. Thanks for the help.
2014-03-26 11:39 GMT+04:00 Matt Johnson notifications@github.com:
I assume you are running RavenDB as a server, not as embedded mode. Correct?
Are you using NodaTime in your RavenDB indexes? If not, you don't need the bundle.
Also, could you please paste a copy of the exception so I can see the exact error? Please include the stack trace if there is one. Thanks.
Reply to this email directly or view it on GitHubhttps://github.com/mj1856/RavenDB-NodaTime/issues/2#issuecomment-38656743 .
ó Õ×ÁÖÅÎÉÅÍ, þÅÒÍ£ÎÎÏ× çÌÅÂ, ÔÅÌ. (916) 314-9324
Well, if I leave everything as it is - writing to a database works ok, but I can't fetch the rows I've just written - same exception occurs on the client. It says Url: "/indexes/dynamic/collection_name?&pageSize=128"
System.IO.FileLoadException: Couldn't load file or assembly "NodaTime, Version=1.1.0.0, Culture=neutral, PublicKeyToken=4226afe0d9b296d1" or one of it's dependencies. (HRESULT: 0x80131040)
File name: "NodaTime, Version=1.1.0.0, Culture=neutral, PublicKeyToken=4226afe0d9b296d1"
in Raven.Bundles.NodaTime.NodaTimeCompilationExtension.GetNamespacesToImport()
in Raven.Database.Linq.QueryParsingUtils.GenerateText(TypeDeclaration type, OrderedPartCollection1 extensions) in c:\Builds\RavenDB-Stable\Raven.Database\Linq\QueryParsingUtils.cs: line 61 in Raven.Database.Linq.DynamicViewCompiler.TransformQueryToClass() в c:\Builds\RavenDB-Stable\Raven.Database\Linq\DynamicViewCompiler.cs: line 89 in Raven.Database.Linq.DynamicViewCompiler.GenerateInstance() в c:\Builds\RavenDB-Stable\Raven.Database\Linq\DynamicViewCompiler.cs: line 594 in Raven.Database.Storage.IndexDefinitionStorage.AddAndCompileIndex(IndexDefinition indexDefinition) in c:\Builds\RavenDB-Stable\Raven.Database\Storage\IndexDefinitionStorage.cs:line 233 in Raven.Database.DocumentDatabase.PutIndex(String name, IndexDefinition definition) в c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs: line 1204 in Raven.Database.Queries.DynamicQueryRunner.CreateAutoIndex(String permanentIndexName, Func
1 createDefinition) in c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryRunner.cs: line 170
in Raven.Database.Queries.DynamicQueryRunner.GetAppropriateIndexToQuery(String entityName, IndexQuery query, DynamicQueryMapping map) в c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryRunner.cs: line 158
in Raven.Database.Queries.DynamicQueryRunner.ExecuteDynamicQuery(String entityName, IndexQuery query) in c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryRunner.cs: line 32
in Raven.Database.Server.Responders.Index.PerformQueryAgainstDynamicIndex(IHttpContext context, String index, IndexQuery indexQuery, Etag& indexEtag) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs: line 609
in Raven.Database.Server.Responders.Index.ExecuteQuery(IHttpContext context, String index, Etag& indexEtag) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs: line 514
in Raven.Database.Server.Responders.Index.GetIndexQueryResult(IHttpContext context, String index) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs: line 448
in Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) в c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs: line 786
in Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) в c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs: line 648
l just re-read the docs, and it says that I should add this line to get things working: configuration.Catalog.Catalogs.Add( new AssemblyCatalog(typeof(NodaTimeCompilationExtension).Assembly) ); How do I add it to the console app?
Actually, scratch that last comment - it doesn't work for me :(
Ok, so I installed 1.1.1 NodaTime - same exception keeps looking for 1.2.0 version of NodaTime. I even tried to align bundle and NodaTime framework version to be 4.0 - no result. Same thing with 1.1.0. sad panda
I'll have some time to look at this later tonight. Thanks for your patience.
You said:
Well, I run it in embedded mode - I installed the RavenDb.Server NuGet package and I just launch Raven.Server.exe every time I want to do something.
In embedded mode, you would add the RavenDB.Embedded
nuget package, and you would only launch your own executable.
If you're installing the RavenDB.Server
nuget package in your solution, and launching Raven.Server.exe
then you are indeed running in server mode. You would also then have the RavenDB.Client
package added to your console application.
Either way - if you don't need NodaTime in your indexes, then you don't need the RavenDB.Bundles.NodaTime
package, nor do you need to copy anything to your plugins folder. Please understand that the core functionality is in RavenDB.Client.NodaTime
, and you only need to follow the instructions here.
It's only when you need index support that you install the bundle, and then you follow these instructions.
You can have the client only, or client+bundle. But not just the bundle by itself.
Put another way, unless you are specifically using the RavenDB.Embedded
package and creating an EmbeddableDocumentStore
in your code, then you should not be adding the RavenDb.Bundles.NodaTime
package to your application. If you decide you need the bundle because you want to use NodaTime types in a static index definition, then you should simply copy both the RavenDB.Bundles.NodaTime.dll
and NodaTime.dll
files to the plugins folder.
Also, you asked about adding the bundle to the configuration catalog. That only applies to embedded mode.
Ok, I will try that. Thanks for your patience and my little knowledge of Raven
HOWEVER, I just tried it with it wired up correctly, and it looks like in server mode, you will need to add an assembly binding redirection to Raven.Server.exe.config
. Add this chunk of XML:
<dependentAssembly>
<assemblyIdentity name="NodaTime" publicKeyToken="4226afe0d9b296d1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
Put it inside the /configuration/runtime/assemblyBinding
node. For example, if you've not made any other changes to Raven.Server.exe.config
then the entire file should look like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Raven/Port" value="*"/>
<add key="Raven/DataDir" value="~\Database\System"/>
<add key="Raven/AnonymousAccess" value="Admin"/>
</appSettings>
<runtime>
<loadFromRemoteSources enabled="true"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Analyzers;Plugins"/>
<dependentAssembly>
<assemblyIdentity name="NodaTime" publicKeyToken="4226afe0d9b296d1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I will update the install docs accordingly.
Applied configuration as you suggested - now RavenDb doesn't throw an exception. I tried to query a collection of objects without static index - didn't work. I guess I have to manually create an index. Thanks for your help.
Be sure to have a look at the examples in the unit tests in this project. If you'd like some direct help, you can reach out to me on skype. My skype names is mattj1856.
Thanks, will do. I'd like to make sure I did everything I can before bothering you.
Finally I got it working. What I did is reinstall RavenDb from scratch, then apply all the instructions from wiki. No exceptions this time, everything went smooth. Just one small hiccup, though - it seems all my experiments screwed Raven Studio completely so it won't even show me what databases I have, not to mention documents. I can live with that. Thanks so much for your help.
Hello. I added 2 NuGet packages - RavenDb.Bundles.NodaTime 2.5.7 and RavenDb.Client.NodaTime 2.5.7- to my project. Everything was fine, I was able to add some rows to a database and saw them in Raven Studio. But when I tried to open Studio a few weeks later, RavenDb console threw an exception saying it can't load NodaTime 1.1.0. The same thing I'm using RavenDb.Server package v2.5.2750 The problem is stil there whether I use Raven-Db.NodaTime compiled against .NET 4.0 or 4.5