Upgrade to DD4T 2.0 – Issues and Fixes

While upgrading to DD4T 2.0, there were some issues/bugs I have encountered – some of them quite obvious, some are tricky and some really drives me crazy – Below is a list of few of them and the resolution which worked for me:

  1. Installing DD4T 2.0 Templates in a CMS Instance:
    Error:
    While installing the DD4T 2.0 templates using the installer available on DD4T website, it always through below error:

    Product: DD4T Templates -- Error 1001. Error 1001. Unable to upload the DD4T Templates into SDL Tridion. Please verify your input.
    Error: The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.
    

    Root Cause:
    This issues happens in the scenario when the CM database is being restored from some other environment. Also, this applies to not only installing the DD4T TBBs but also for any Custom TBBs referring the DD4T TBBs.

    Resolution:

    • Open the Tridion CM database in SQL Server Management Studio
    • Locate the table – Queue_Consumer and open it in edit mode
    • Mark status of all other hosts from online to offline – you need to update the field value IS_ONLINEto 0 for all hosts other than your current host machine.
      dmcyt
  2. Using Component Factory in DD4T 2.0
    Error:
    ComponentFactory in DD4T 2.0 is marked as “deprecated” but the code (which is working fine till DD4T 1.31) does not work while using ComponentFactory in DD4T 2.0.

    Root Cause:
    The ComponentFactory has been marked as deprecated but all the method in the class are throwing “Not Implemented” exception.

    This has been raised as a bug with DD4T team and can be followed here – Issue 79

    Resolution:
    Use Component Presentation Factory instead of Component Factory. If you need to get an IComponent object, then you can use

    ComponentPresentationFactory.GetComponentPresentation().Component
    
    
  3. Using already published Xml Format DCP with your updated DD4T project
    Error:
    You can use the Xml Format DCP (published through older version of DD4T) with your DD4T 2.0 APIs; however, depending on your Content Delivery code, after update to DD4T 2.0, you might get below error:

    Object reference not set to an instance of an object

    Root Cause:
    In the ContentModel.cs class, quite a few numbers of attributes related to Metadata and Keywords are decorated with [XmlIgnore]. Due to this, while you try to Xml Deserialized, you will receive these XmlIgnored attributes as null.

    This has been raised as a bug with DD4T team and can be followed here Issue 80

    Resolution:
    You may either need to wait for this issue to be fixed by the DD4T team or you can take the latest code for the DD4T.Model package, update the ContentModel.cs class in it to remove the [XmlIgnore] attributes. Create a fresh DD4T.ContentModel.dll and replace it in the DD4T.Model package in your project.
    NOTE: If you restore your package from nuGet again, it may overwrite your solution.

  4. Publishing with Custom TBBs referring the DD4T TBBs
    Error:
    In case you have some custom TBBs written for your specific business need and it is expecting the XML format  to manipulate with, the publishing will fail in “Rendering” phase

    Root Cause:
    The DD4T 2.0 does not produce the XML format output but only JSON format instead.

    Resolution:
    Update your custom TBBs such that it does not depends and manipulate the XML format content but accets and work with the JSON format.

Tagged with: , , , ,
Posted in SDL Tridion

Upgrade to DD4T 2.0 – Content Manager (CM)

Upgrading the Content Manager side with DD4T 2.0 is relatively simple as compared with the Content Delivery side. Typical steps you would be following are mentioned as below:

Approach 1:

  1. Download the Template installer from HERE
  2. Execute the following batch file from the downloaded template installer and follow the instructions:
    install-templates.bat
  3. Ensure the batch file gets executed successfully and DD4T 2.0 TBBs and Schema got created in the folder specified while executing the script above
  4. Now, each and every Component Templates (CT) and Page Template (PT) must be changed to reference these new DD4T  as well as require migration of any metadata values from the older TBB to the new TBB
  5. You will also need to remove the reference to the Publish Binary in Component and Publish Binary in Page TBBs from your templates
  6. You can now choose to publish the Components/Pages with these updated templates

Approach 2:

  1. Follow the steps 1, 2 and 3 above for a temporary or dev CMS system and ensure the WebDav Path of the folder specified is the same as the existing older DD4T TBBs in the target CMS system
  2. Create a Content Porter export package of each item in this folder
  3. You will also need to remove the reference to the Publish Binary in Component and Publish Binary in Page TBBs from your CTs and PTs
  4. Import the CP Package in the target CMS system
  5. Caution: this may override the Metadata values specified in the older TBBs


Points to note:

  • The new Templates will generate the rendered output in JSON format and if you are using a custom TBB which might be using the older XML format “output” and parsing it, will throw an exception and you need to update your custom TBBs to accept and work with JSON format
  • If this is too much of work for specific templates to change the TBBs to accept the XML to JSON – there is small hack can be done for those specific templates to still generate the output in XML format – I will post a separate blog post with step by step guide to do this – Stay Tuned!!
Tagged with: ,
Posted in SDL Tridion

Upgrade to DD4T 2.0 – Content Delivery (CD)

In the process of upgrading your existing DD4T  based implementation to latest DD4T 2.0 based implementation, the major effort is required in the Content Delivery side.

You would typically be following below process for upgrading your code/implementation to the DD4T 2.0:

Reference Fixes:

Typically, you would be doing following:

  • Removes all references to DD4T 1.31 dlls from each project in your website solution
  • Download and Install DD4T packages using NuGet Manager – What all packages you may need to install depends on your specific implementation requirement, however, you would mostly be downloading and installing following packages:
    • DD4T.MVC5
    • DD4T.Model
    • DD4T.Core
    • DD4T.Providers.SDLTridion2013 or DD4T.Providers.SDLTridion2013sp1 or DD4T.Providers.SDLTridion2011
    • DD4T.DI.Unity or DD4T.DI.Ninject or DD4T.DI.Autofac – In case you are using a DI mechanism provided by Unity or Ninject or Autofac respectively
  • Ensure, all necessary projects now have a reference to these newly downloaded DD4T 2.0.x.x version dlls

Compiling the Solution:

There may be a variety of compile time errors after changing the references to the new DD4T dlls. The magnitude of compile errors and their fixes entirely depends on the implemented code, usage & customization/extending/overriding of DD4T classes/methods and cleanliness of the code. You can get an idea of changes and challenges you might face by referring the below list of typical compile issues I have faced and required a resolution in the code: (The below list may be different in your implementation)

  • Change all references of D4T.ContentModel.Logging to  DD4T.ContentModel.Contracts.Logging
  • Change all references of D4T.ContentModel.Logging.ILogWrapper to DD4T.ContentModel.Contracts.Logging.ILoggers
  • Change all references of DD4T.Utils.LoggerService to DD4T.Utils.Logger
  • Change all references of DD4T.Providers.SDLTridion2013 to DD4T.Providers.SDLTridion2013sp1
  • Change all method calls of GetView(ComponentPresentation) to View(GetViewName(ComponentPresentation))
  • Need to re-implement IPage interface for newly added method – IDictionary<string, IFieldSet> ExtensionData
  • A variety of DD4T classes now does not have a parameter-less constructor, additionally, most DD4T classes have changes in the constructure signature – This requires a change in all those classes in the implementation inheriting from these DD4T classes.
  • PageFactory now does not have a parameter-less constructor and also have its constructor accepting additional parameters – This means if there is any customization/extending of this class, you need to appropriately make changes in that class to support the updated constructor
  • TridionControllerBase now does not have a parameter-less constructor and also have its constructor accepting additional parameters – This means if there is any customization/extending of this class, you need to appropriately make changes in that class to support the updated constructor
  • Need to change all references to DefaultComponentPresentationRenderer as there is no parameter-less constructor

Run-time Fixes

After all compile errors are resolved, you may come across a variety of run-time errors which also need to be fixed. These run-time errors entirely depends on specific implementations. Few major changes, I experienced while upgrading are as below:

  • All references to IComponentProvider must be changed to IComponentPresentationProvider. The IComponentProvider is marked as deprecated in DD4T2.0 so you will not get any compile time error, but actually, all the methods in IComponentProvider are throwing NotImplemented exception.
  • Change of IComponentProvider to IComponentPresentationProvider means we also need to change any reference of IComponentFactory to IComponentPresentationFactory
  • Above changes suggests, all method calls to GetComponent may need to be changed to GetComponentPresentation. 
  • Further this means, TryGetComponent would be changed to TryGetComponentPresentation – Please note the parameters order is changed for these two method
  • Following new dependencies must be declared for your DI module in use (In my case it was Windsor, so a bit of different process):
    • IProvidersCommonServices
    • IDD4TConfiguration
    • IFactoryCommonServices
    • IComponentPresentationFactory
    • IComponentPresentationProvider
    • ILinkResolver

There may more or less changes during the run time as well as compile time depending on your specific implementation and code.

BTW – Not to mention the great help from Harald Hoffelinck in identifying and resolving some of these critical issues.

NEXT – Upgrade to DD4T 2.0 – Content Manager (CM)

Tagged with: , ,
Posted in SDL Tridion

Upgrade to DD4T 2.0 – Overview

Recently I got a chance to upgrade a big enterprise level neat implementation with SDL Tridion 2013 SP1 and DD4T 1.31 to DD4T 2.0. A big thanks to Harald Hoffelink for helping in a big way to achieve this. Ahh BTW, this was a .NET based implementation.

Why you should upgrade to DD4T 2.0 from an earlier version:

Following are few benefits that you should be considering for upgrade to DD4T 2.0 –

  • DD4T 2.0 now renders in JSON format instead of XML and also omits rarely used data elements – this means a smaller transport package size thereby decreasing the overall publishing time due to reduced transport time
  • Compression of published data – means further smaller size of data in the transport package as well as in the broker DB which further means a faster publishing and a faster website
  • Resolves binaries and publish them by default – means no need to add “Publish binaries for components” TBB
  • Support for SDL Media Manager
  • Support for ECL
  • A number of Bug Fixes – bugs related to linking of multimedia in RTF field, bugs related to keywords (e.g. a binary linked in a multimedia field in the keyword’s metadata does not get publish OOTB in earlier versions) etc.

Steps involved in a typical DD4T 2.0 upgrade:

On a high level, you would be doing following:

CM Side

  • Download and install the DD4T TBB setup on your CM server following the instructions provided on http://www.dd4t.org – Do Not try to overwrite the existing TBBs of older DD4T version
  • Changes the reference in all your CTs and PTs for using these updated TBBs
  • Try Publishing the content (page and component) using these new TBBs and ensure it is publishing successfully.

NOTE: DD4T 2.0 does not (at the time of writing this) support to XML and only renders the JSON output – This means if you have any customization in TBBs or if you are using a custom TBB along with DD4T TBBs to make a compound template – Well you may need to rewrite all those TBBs

CD Side:

  • Remove references to older DD4T dlls
  • Download and Install the DD4T 2.0 packages using NuGet Manager
  • Ensure your project is using references to these new dlls
  • Compile the project – You would be presented with few hundreds of compile errors due to various changes in the framework – work on to resolve these compile errors
  • Once compiled try to run your project – you may come across few run time error – this depends on your existing code and mostly due to new dependencies introduced which you may need to define in your DI framework
  • DD4T 2.0 is known to be backward compatible and should be working with your previously published items in XML format but this is something you should test
  • Publish your new items in JSON format and test your code

NOTE: The number and resolution of compile time errors and run time errors depends on a variety of factors including how much customization of DD4T classes have been done

NEXT – Upgrade to DD4T 2.0 – Content Delivery (CD)

NEXT – Upgrade to DD4T 2.0 – Content Manager (CM)

Tagged with: , , ,
Posted in SDL Tridion

Highlights: SDL Web 8 Dev Summit at India

The last week on 5th and 6th Feb 2016 was one of the most awaited days for me as this is the time SDL Web 8 Dev Summit at New Delhi in India is going to kicked off. It is supposed to be a grand event as more than 55 SDL professionals are attending including 7 MVPs and Community builders.

1

 

Moreover, after a lots of planning and brainstorming along with the SDL India Community team, it really requires some ground level work starting from designing and printing banners, designing and creating goodies for each of the sponsors, designing and printing other event related materials, hotels searching, negotiating and booking, food and lot lot more which the whole team has done fantastically.

The Park Hotel at connaught place in delhi – one of the most happening place in India and situated at the heart of the New Delhi city is ready to host us with its best in class hospitality, service and delicious Indian Food.

Each participant at the registration desk is greeted with goodies having logos of Sponsors printed – SDL hot mugs, Content Bloom Pen Drive (with SDL Web 8 offline documentation) and Espire Caps makes the participants excited.

goodies

The presence of the Legend (read as Nuno Linhares), Bart, Robert Curlette and Elena along with other MVPs (Raj, Saurabh) energies the event and everybody was excited to have a selfie with each one of them – I hope each one of them was feeling like a Rock star :).

Nuno started with a great session on SDL strategy and road map ahead clearing some dust from “SDL selling non-core business” news. The sharing goes new height with Robert Curlette demoing Alchemy and Bart with DXA.

2

The hashtag – #sdlindiameet – was a hit with over 200+ tweets

There were few competitions held to add spice to the event and increasing the community sharing – people keep on sharing their great experiences with SDL tridion in the Experience Sharing competition and excellent ideas in the Idea Sharing Competitions. There was also a Pot-Luck quiz which has SDL Certification vouchers to be won by answering a simple question.

Lastly, the two days wrap up with a message to the community from All MVPs and Community Builders for doing their bit for the community and share as much as they can.

All the fun of the event can be virtually realized at:

Twitter

Facebook

Posted in SDL Tridion

Installing SDL Web 8 – CM and DB Setup

This series of post try to list down possible steps to install SDL Web 8 on a virtual machine. This specific post will list down steps to install SDL Web8 Content Manager modules.

Further Assumption – The installation will assume using x64 machine with MS SQL Server DB as back-end.

Before you starts Installation and Setup, please refer this post for the SDL Web 8 Prerequisite.

The step-by-step guide to install SDL Web 8 Content Manager is as below:

Setup Machine

  • Get ready with a Microsoft Windows Server 2012 R2 (x64) or Windows Server 2008 R2 SP1 (x64) VM and logged into it with you Content Manager Administrator User.
  • Ensure you have checked for windows update and download/install them
  • Install MS SQL Server 2014 or MS SQL Server 2012 R2 SP2
  • Again check for windows update and download/install them after MS-SQL Server installation
  • Create an MTS User – Preferably with Admin rights – If you have issues with Admin rights, you may refer this post of Minimum Access Rights for MTS User

Setup Database

  • Open Windows Powershell by right clicking as choosing “Run As Administrator”
  • Navigate to the below SDL Web8 Installation media path in powershell – .\SDL_Web_8\Database\mssql
  • Create Content Manager Database as per the below screenshot:
    InstallCMDB
  • Create Broker Database as per the below screen sheet:
    InstallBrokerDB
  • Create Discovery Service Database as per below screen shot:
    InstallDiscoveryServiceDB
  • Create Preview Session (XPM) Database as per the below screen shot:
    InstallXPMDB
  • Create Topology Manager Database as per the below screen shot:
    InstallTopologyMgrDB

Install Content Manager

  • Navigate to the SDL Web Installation Media and run SDLWeb8CM.exe by right clicking and choosing “Run as administrator”
    CMSetup1
  • Select SDL Web features you want to install and click “Next”:
    CMSetup2
    In case you want to install Audience Manager and Outbound EMail, User Generated Content and Translation Manager – you first need to create the respective Database like we have created other database in earlier section.
  • Next the setup will shows you all the missing prerequisite which SDL Web must have to work properly – You need to accept to install these missing prerequisite:
    CMSetup3
  • Once the prerequisites are all installed, you need to provide details of your MTS User:
    CMSetup4
  • Next enter the details of Content Manager DB as created in earlier step:
    CMSetup5
  • Next enter the details of Topology Manager DB as created in earlier step:
    CMSetup6
  • Next enter the Environment ID – this is typically to identify your CM instance in case of a scaled out and/or load balanced environment. For a standalone environment, you can leave it default:
    CMSetup11
  • Next Provides the access details of Tridion Website – In host header provide the DNS using which you will be accessing the SDL Tridion CM instance – I would (personally) recommend it leaving blank in case of non-registered DNS names.
    CMSetup8
  • Similarly provides details of SDL Web Topology Manager website in the next step:
    CMSetup9
  • Next Enter details for various Topology Manager groups – if you are unsure what you are doing – leave them to default:
    CMSetup10
  • Next Enter the Content Manager root URL as per the details given above:
    CMSetup11
  • Next Enter the path for your Content Manager License (license.xml) and Content Delivery License (cd_licenses.xml):
    CMSetup12
  • Next wait for the installation process to finish:
    CMSetup14
  • If the installation succeed, you will be prompted with a success screen and will ask you to restart the machine – Restart the machine to complete the installation:
    CMSetup15

Once the system restarts, you may access the SDL Tridion Manager explorer to manage your data with the Content Manager Website url given in the earlier step

NEXT – Installing SDL Web 8 – Content Delivery Setup (will be Published soon)

 

Tagged with: , , ,
Posted in SDL Tridion

Alchemy PlugIn – Component Synchronizer

What is component synchronization

Quite often when you change your schema with changes like adding fields with default values, changes xml field names, namespace changes etc.; it require all components based on that schema to be synchronize with these new changes. As soon as you open an existing Component, it will automatically adopts the changed schema structure and saving it back will synchronize the component, however, in case there are hundreds or thousands of such components then this synchronization becomes a cumbersome and tedious job to achieve manually. Further, if you add a new field with some default value to starts with, the existing components won’t automatically fill that field with the default value unless you edit the component and manually enter this field.
Fortunately, There are multiple options to achieve this like the Community Power Tool , Core Service custom code as Described HERE or you can write your own code to achieve this.

I would like to add another option to achieve this through a sweet Alchemy PlugIn – Component Synchronizer.

What you can do with this Alchemy PlugIn

You can achieve following:

  • Select a component and synchronizes it with its schema for all the changes made in the schema at once
  • Select a component and choose to synchronize it for specific change like Namespace changes, Field XML name changes, Applying default values etc.
  • Select a Schema and synchronizes all components based on this schema in one go

Supported Tridion Version

Currently it supports only SDL Tridion 2013 SP1. The work for providing support to older version is under progress.

Code Repository

The code for the this alchemy plug-in can be found on GitHub at below URL: GitHub – Component Synchronizer

Disclaimer

Any Component Synchronization may results in data loss. This is highly recommended to backup your content before you execute any component synchronization on your components and/or schema.

Posted in SDL Tridion