More in this section

Forums / Developing with Sitefinity / Error when importing template data

Error when importing template data

4 posts, 0 answered
  1. Chong Peng Pang
    Chong Peng Pang avatar
    2 posts
    Registered:
    02 Oct 2009
    03 Oct 2009
    Link to this post

    Hi,

    I have exported an existing project as new template and use it for a new project. When creating the new project, I also modified web.config content to include applicationName="my_new_site" as explained in this thread:http://www.sitefinity.com/support/forums/sitefinity-3-x/general-discussions/import-existing-sitefinity-project.aspx

    However, I still have this error when setting up the new project:

    Importing template data failed: An object with the same primary key already exists in the cache.. Check the error log for more details.

    These is the content of the error log :

    Exception Type: Nolics.ORMapper.Base.NolnetException

    Message: An object with the same primary key already exists in the cache.

    Source: Nolics.Engine.v4.2

    Stack Trace:
       at Nolics.ORMapper.Base.OdbClassHelper.CreateClass(IOdbClass cl, Transaction tran, OdbDataProvider provider, ObDataCache cache, OdbObjectStates& state, OdbDataProvider& curProvider, ObDataCache& curCache)
       at Telerik.Cms.Engine.Data.MetaData.Create(Transaction tran, OdbDataProvider provider, ObDataCache cache)
       at Nolics.ORMapper.Base.Transaction.Create(IOdbClass mem, OdbDataProvider provider)
       at Telerik.Cms.Engine.Data.ContentVersion.SetMetaDataInternal(Transaction tran, IMetaInfo metaInfo, Object value)
       at Telerik.Cms.Engine.Data.ContentVersion.SetMetaData(String key, Object value)
       at Telerik.Cms.Engine.Data.CmsContentBase.SetMetaData(String key, Object value)
       at Telerik.Cms.Engine.ContentProviderBase.Import(DataSet dataSet)
       at Telerik.Cms.Engine.GenericContentModule.Import(DataSet source)
       at Telerik.Cms.Tools.SiteExporter.Import(String templateName)
       at Telerik.Cms.Web.StartupWizard.SiteTemplatePane.DoWork()
    -----------------------------------------------------------------------------------------------------

    Can you please assist ? The existing and new project are both accessing same database.

    Thanks in advance.
    Regards
    Pang

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    04 Oct 2009
    Link to this post
    Hi Chong Peng Pang,

    Please take a look at the following forum post which provides detailed steps for setting project from a template. I hope this helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Chong Peng Pang
    Chong Peng Pang avatar
    2 posts
    Registered:
    02 Oct 2009
    05 Oct 2009
    Link to this post
    Hi Ivan,

    Yes, I did study the post before I decided to post for help here.  I followed exactly what you have said, including adding applicationName="NEW_APP_NAME" to <cms>  and <cmsEngine> tag in web.config and modify GUIDs in CmsPages.xml using the codes you provided. However I still get these errors:

    ---------------------------------------------------------------------------------------------
    Exception Type: Nolics.ORMapper.Base.NolnetException

    Message: An object with the same primary key already exists in the cache.

    Source: Nolics.Engine.v4.2

    Stack Trace:
       at Nolics.ORMapper.Base.OdbClassHelper.CreateClass(IOdbClass cl, Transaction tran, OdbDataProvider provider, ObDataCache cache, OdbObjectStates& state, OdbDataProvider& curProvider, ObDataCache& curCache)
       at Telerik.Cms.Engine.Data.MetaData.Create(Transaction tran, OdbDataProvider provider, ObDataCache cache)
       at Nolics.ORMapper.Base.Transaction.Create(IOdbClass mem, OdbDataProvider provider)
       at Telerik.Cms.Engine.Data.ContentVersion.SetMetaDataInternal(Transaction tran, IMetaInfo metaInfo, Object value)
       at Telerik.Cms.Engine.Data.ContentVersion.SetMetaData(String key, Object value)
       at Telerik.Cms.Engine.Data.CmsContentBase.SetMetaData(String key, Object value)
       at Telerik.Cms.Engine.ContentProviderBase.Import(DataSet dataSet)
       at Telerik.Cms.Engine.GenericContentModule.Import(DataSet source)
       at Telerik.Cms.Tools.SiteExporter.Import(String templateName)
       at Telerik.Cms.Web.StartupWizard.SiteTemplatePane.DoWork()
    ---------------------------------------------------------------------------------------------

    One thing I did find out is that if I delete generic_content.xml, the errors amazingly disappear and project created successfully. But, I CANNOT publish any file using Generic Content in the project as it gives me this error:

    You cannot change a value of an object that is not in transaction.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Nolics.ORMapper.Base.NolnetException: You cannot change a value of an object that is not in transaction


    Any idea how to solve the problem ? Have I missed anything ?

    Thanks for your patience.
    Regards
    Pang

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Oct 2009
    Link to this post
    Hi Chong Peng Pang,

    1. There is a limitation regarding the importer. It is developed to import data in an empty database.
    2. The provided code works only for pages.
    3. It will be not possible for us to provide code that applies for Generic Content base modules and replaces the IDs.

    If you share the exact reason for importing a template in the same database we could try to come up with another solution.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered