Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experience Extractor - Parse issue #14

Open
SamridhiSachdeva opened this issue Feb 1, 2017 · 2 comments
Open

Experience Extractor - Parse issue #14

SamridhiSachdeva opened this issue Feb 1, 2017 · 2 comments

Comments

@SamridhiSachdeva
Copy link

Hello.
I installed ExperienceExtractor-0.3.0 on Sitecore 8.2 and got following error.

System.Collections.Generic.KeyNotFoundException: No parse factory registered for type IDataSource with key "xdb" (Source)
at ExperienceExtractor.Api.Parsing.JsonJobParser.Parse[TType](ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JsonJobParser.cs:line 67
at ExperienceExtractor.Api.Parsing.JobParser.ParseDataSource(ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 69
at ExperienceExtractor.Api.Parsing.JobParser.CreateDataSource() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 134
at ExperienceExtractor.Api.Jobs.Job.Run() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Jobs\Job.cs:line 109

{
"Id": "8c15d967-7ff8-4e00-b8f6-e9f37148385f",
"Created": "2017-02-01T11:41:44.1180603+05:30",
"Ended": "2017-02-01T11:41:44.1220583+05:30",
"ItemsProcessed": 0,
"RowsCreated": 0,
"Progress": null,
"Status": "Failed",
"StatusText": "System.Collections.Generic.KeyNotFoundException: No parse factory registered for type IDataSource with key "xdb" (Source)\r\n at ExperienceExtractor.Api.Parsing.JsonJobParser.Parse[TType](ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JsonJobParser.cs:line 67\r\n at ExperienceExtractor.Api.Parsing.JobParser.ParseDataSource(ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 69\r\n at ExperienceExtractor.Api.Parsing.JobParser.CreateDataSource() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 134\r\n at ExperienceExtractor.Api.Jobs.Job.Run() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Jobs\Job.cs:line 109",
"SizeLimitExceeded": false,
"Url": "/sitecore/experienceextractor/jobs/8c15d967-7ff8-4e00-b8f6-e9f37148385f",
"Specification": "{\r\n "labels": "en-US",\r\n "source": {\r\n "xdb": {\r\n "filters": [\r\n {\r\n "daterange": {\r\n "start": "2014-01-01Z"\r\n }\r\n },\r\n {\r\n "limit": 1000\r\n }\r\n ]\r\n }\r\n },\r\n "mapper": {\r\n "tables": [\r\n {\r\n "name": "MonthlyVisits",\r\n "fields": [\r\n {\r\n "date": {\r\n "resolution": "month"\r\n }\r\n },\r\n {\r\n "dimension": {\r\n "name": "Geo",\r\n "fields": [\r\n {\r\n "xa": "Visits/By Country"\r\n },\r\n {\r\n "xa": "Visits/By Region"\r\n },\r\n {\r\n "xa": "Visits/By City"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n "xa": "Visits/By Campaign"\r\n },\r\n "facts"\r\n ]\r\n }\r\n ]\r\n },\r\n "postprocessors": []\r\n}",
"LastException": "System.Collections.Generic.KeyNotFoundException: No parse factory registered for type IDataSource with key "xdb" (Source)\r\n at ExperienceExtractor.Api.Parsing.JsonJobParser.Parse[TType](ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JsonJobParser.cs:line 67\r\n at ExperienceExtractor.Api.Parsing.JobParser.ParseDataSource(ParseState state) in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 69\r\n at ExperienceExtractor.Api.Parsing.JobParser.CreateDataSource() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Parsing\JobParser.cs:line 134\r\n at ExperienceExtractor.Api.Jobs.Job.Run() in c:\Projects\ExperienceExtractor\Git\experience-extractor\src\ExperienceExtractor\Api\Jobs\Job.cs:line 109"
}

@blipson89
Copy link

@SamridhiSachdeva did you ever find a way around this?

@massimde
Copy link

massimde commented Sep 25, 2018

Reading log file i found this:
Exception: System.Reflection.ReflectionTypeLoadException
Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Source: mscorlib
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at ExperienceExtractor.Api.Parsing.ReflectionHelpers.GetAllTypes(Assembly assembly)
at ExperienceExtractor.Api.Parsing.ParseFactories.InitializeFromAttributes(Assembly assembly)
at ExperienceExtractor.Api.Pipelines.ExperienceExtractorApiInitializer.Process(PipelineArgs args)

22992 10:56:39 ERROR Error loading parse factories
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'MongoDB.Driver, Version=1.11.0.92, Culture=neutral, PublicKeyToken=f686731cfb9cc103' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

...So the problem is related by the wrong version of MongoDB.Driver. But my Sitecore installation needs the 2.44 version!

I've downloaded the code from https:/Sitecore/experience-extractor and restored nuget packages for my Sitecore 8.2 Update 5 installation.
The only problem, now, is related to MongoDB.Bson package ver 2.4.4 that doesn't implement BsonBuffer class (http://api.mongodb.com/csharp/1.11/html/00b3830e-ab56-6d53-43cc-2db1a9936f33.htm) called in ExperienceExtractor.MongoDb.Helpers, so the ExperienceExtractor.MongoDb project doesn't build.
I'v changed the ExperienceExtractor.MongoDb.Helpers class as follows ( i don't know if it's the best approach to deserialize using the API ):

`

 public static IEnumerable<T> FastSpool<T>(this MongoCursor<RawBsonDocument> cursor, int threads = 2){
        var binaryReaderSettings = new BsonBinaryReaderSettings(); 
        binaryReaderSettings.MaxDocumentSize = int.MaxValue;
        var serializer = BsonSerializer.LookupSerializer(typeof(T));

        return cursor
            .AsParallel().AsOrdered()
                .WithExecutionMode(ParallelExecutionMode.ForceParallelism)
                .WithDegreeOfParallelism(Math.Max(1, threads))
            .Select(doc =>
            {                    
                using (doc)
                {
                    using (var stream = new ByteBufferStream(doc.Slice))
                    using (var reader = new BsonBinaryReader(stream, binaryReaderSettings))
                    {
                        var context = BsonDeserializationContext.CreateRoot(reader);
                        return (T) serializer.Deserialize(context);
                    }
                    // Old code
                    //return (T)serializer.Deserialize(new BsonBinaryReader(new BsonBuffer(doc.Slice, false), binaryReaderSettings),
                    //    typeof(T), null);
                }
            });   
    }`

After this change, it works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants