Queries and Bindings not Importing

Topics: Customizing Orchard, Troubleshooting
Nov 2, 2012 at 9:15 PM

Hello. I'm running Orchard 1.5.1 (unable to upgrade to 1.6 yet), and I've run into a problem while trying to export my data and import into a new instance.

I exported my Queries from Instance 1, but when I went to import them into Instance 2, they do not appear. I had created several Member Bindings via the UI in Instance 1, and I noticed that those were not exported. I'm guessing that's why my queries won't import.

Can someone provide some guidance on the best approach to get my queries to import? I'm at a loss and I have several queries and projection pages on the line.

Thanks!

Developer
Nov 2, 2012 at 10:14 PM

Could you verify that the expected query data is there in the export.xml file? Also check the error logs to see if any errors have occurred.

Nov 2, 2012 at 11:19 PM
Edited Nov 2, 2012 at 11:21 PM

All of my query data is in the export file, but here's something. I looked at the error logs and these all seem to do with importing Taxonomies. Several of my queries had Taxonomy Term filters on the Content. I just did a forum lookup and it sounded like there was maybe a bug related to this? I'm not sure if it's the same issue. I'm on the official 1.5.1 release and cannot upgrade. If there are any work arounds or partial code updates i can make, I'd be happy to. I just need guidance. This is halting a deployment because without queries, I have no projections, and without projections, I don't have site content :-)

Here are the logs I spoke of:

2-11-02 19:43:57,898 [19] NHibernate.Impl.AbstractSessionImpl - DTC transaction prepre phase failedNHibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: Orchard.Projections.Models.QueryPartRecord.FilterGroups   at NHibernate.Engine.Collections.ProcessDereferencedCollection(IPersistentCollection coll, ISessionImplementor session)   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushCollections(IEventSource session)   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)   at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)   at NHibernate.Impl.SessionImpl.Flush()   at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.DistributedTransactionContext.System.Transactions.IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)      

2012-11-02 19:33:23,965 [19] NHibernate.Impl.AbstractSessionImpl - DTC transaction prepre phase failedNHibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: Orchard.Projections.Models.QueryPartRecord.FilterGroups   at NHibernate.Engine.Collections.ProcessDereferencedCollection(IPersistentCollection coll, ISessionImplementor session)   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushCollections(IEventSource session)   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)   at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)   at NHibernate.Impl.SessionImpl.Flush()   at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.DistributedTransactionContext.System.Transactions.IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)

2012-11-02 19:32:50,902 [19] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caughtSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Orchard.OrchardCoreException: Recipe execution with id 11b9ce718f934429807f5d7def740686 was cancelled because the "Data" step failed to execute. The following exception was thrown: Unknown content type for /Identifier=be5a0e5ee2834c63a26b608c0413ee7b. Refer to the recipe journal for more information.   at Orchard.Recipes.Services.RecipeStepExecutor.ExecuteNextStep(String executionId)   at Orchard.Recipes.Services.RecipeScheduler.ExecuteWork(String executionId)   --- End of inner exception stack trace ---   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   at Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String methodName, IDictionary`2 arguments, IEnumerable& returnValue)   at Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue)   at Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, IEnumerable& returnValue)

2012-11-02 19:32:50,324 [19] Orchard.Recipes.Services.RecipeStepExecutor - Recipe execution 11b9ce718f934429807f5d7def740686 was cancelled because a step failed to executeSystem.ArgumentException: Unknown content type for /Identifier=be5a0e5ee2834c63a26b608c0413ee7b   at Orchard.ContentManagement.ImportContentSession.Get(String id)   at Orchard.Projections.Drivers.ProjectionPartDriver.Imported(ProjectionPart part, ImportContentContext context)   at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.Imported(ImportContentContext context)   at Orchard.ContentManagement.DefaultContentManager.Import(XElement element, ImportContentSession importContentSession)   at Orchard.Recipes.RecipeHandlers.DataRecipeHandler.ExecuteRecipeStep(RecipeContext recipeContext)   at Orchard.Recipes.Services.RecipeStepExecutor.ExecuteNextStep(String executionId)

2012-11-02 19:32:47,637 [19] Orchard.ContentManagement.DefaultContentManager - NullReferenceException thrown from IContentHandler by Contrib.Taxonomies.Handlers.TermsPartHandlerSystem.NullReferenceException: Object reference not set to an instance of an object.   at Contrib.Taxonomies.Services.TaxonomyService.GetContentItemsQuery(TermPart term, String fieldName)   at Contrib.Taxonomies.Services.TaxonomyService.GetContentItemsCount(TermPart term, String fieldName)   at Contrib.Taxonomies.Handlers.TermsPartHandler.RecalculateCount(IContentManager contentManager, ITaxonomyService taxonomyService, TermsPart part)   at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.Published(PublishContentContext context)   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger)

Developer
Nov 3, 2012 at 5:06 AM

I don't think that there has been any changes made in Taxonomies since 1.5, so the code from 1.6 won't help you. Can you reproduce this problem with a clean 1.6 install? If so then please file a bug. For your instance, you could try and attach a debugger and let it break at where the exception happens and do some inspections to see what exactly is null and possibly correct the issue.

Nov 3, 2012 at 1:34 PM

Thanks for the feedback Sipke. I'll try attaching a debugger this weekend and see if I can track down the code that is falling apart. Maybe it's easily fixable. 

The only reason why I thought that this was a known issue is because of Bertrand and Sebastien's comments on this post: http://orchard.codeplex.com/discussions/264372. 

I'll try spinning up a fresh 1.6 install too just to see what happens. In the meantime, if there are any other ideas, and I'm happy to give them a try. 

Nov 5, 2012 at 1:06 PM

My issue isn't resolved, but I'm further along. 

There was a hibernate bug in the QueryPartDriver on Importing that has been resolved in 1.6, but I went ahead and made that change locally in my 1.5.1 instance. That fixed the "A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance" error. I also had to break out my exports and imports and shuffle the order a bit - making sure dependencies were resolved. 

I'm still back to the custom Member Bindings that I had added. I exported "Query", and when I look through the XML, I see nothing about Bindings being referenced. I do however see all of my queries with their filters, etc. I tried importing these into a new setup and it imported them, but several of the filters were incorrectly set. I'm wondering if that has to do with the Bindings not being in place at the time of import - it can't properly map?

I've successfully created SortFilters before, but I couldn't get ContentFilters to work correctly. Maybe this would help. Any pointers or places to look at a solid Member ContentFilter example?