Are you manually setting up a Tridion Deployer and using a guide such as Nuno’s excellent post titled Manually configuring a Tridion 2011 .NET Content Deployer Instance? Is it working? If so, move on, this article is not for you. If not, or you would like to learn how to troubleshoot a Deployer to publish to the Broker Database – read on.

Deployer debugging overview

The Deployer can run as a Windows service or a Website. In this article I discuss the option to run it as a website. I prefer this option as it allows me to run multiple Deployers on 1 machine and I also feel I have more control over it. Read Nuno’s post above for details about how to setup a manual Deployer. I’m going to highlight a way to debug the Deployer and describe one tiny issue that costs me hours of frustration.

I’m using IIS and in the end of the article I have my file setup. Notice I have a logs folder in there. The location of this folder is configured in the logback.xml file. Snippet from logback.xml:

  <property name="log.pattern" value="%date %-5level %logger{0} - %message%n"/>
    <property name="log.history" value="7"/>
    <property name="log.folder" value="c:/tridion/deployer-Broker/log"/>
    <property name="log.level" value="Info"/>
    <property name="log.encoding" value="UTF-8"/>

This tells my Deployer to put the logs for it (and not for anything else) in the log folder. This is not the default setting and I do suggest you change it to a specific folder per Deployer. After changing any config file we need to restart the Deployer. This can be done by recycling the App Pool or simply doing an ‘iisreset’ if you’re on your own local dev machine.

The other thing to notice is my license file is in the config folder. And here was my fatal mistake – my license file was called ‘cd_license.xml’ and Tridion assumes it is called ‘cd_licenses.xml’ or I can manually put the name in on the bottom of the cd_storage_conf.xml config file. Big thanks to Mihai Cădariu for Yet Another Tridion answer that saved me time and my sanity.

The solution

Tridion uses Filesystem bindings (and not the DB ones in the config file you specified) as a fallback and default when it cannot find or load the cd_licenses.xml file. It logs this in the cd_core.log file and not the cd_deployer.log file. In fact, the cd_deployer.log file looks normal and doesn’t give us any clues it’s using the fallback Filesystem Deployer due to a license issue.

Summary

Tridion deployment is at the heart of every Tridion implementation. Setting up and configuring a Deployer is a task often done by Developers on a new system, such as my Azure Tridion 2013 SP1 instance (Medium instance, SQL Server 2012 instance type, runs great!). Following Nuno’s guide we can quickly get one setup. However, debugging it and finding small problems is sometimes not so easy. I hope this small tip helps show some insight into one potential issue and how to solve it.

Directory: C:\tridion\deployer-Broker

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         3/17/2014   3:12 PM            bin
d----         3/17/2014  10:20 AM            log
-a---         3/17/2014   3:13 PM          0 dir.txt
-a---        11/10/2013   9:29 PM        121 HTTPUpload.aspx                                                           

    Directory: C:\tridion\deployer-Broker\bin

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         3/17/2014   8:55 AM            config
d----         3/17/2014   3:12 PM            lib
-a---        11/10/2013   9:29 PM     172032 netrtsn.dll
-a---        11/10/2013   9:29 PM      22528 Tridion.ContentDelivery.Configuration.dll
-a---        11/10/2013   9:29 PM     114688 Tridion.ContentDelivery.dll
-a---        11/10/2013   9:29 PM    1323008 Tridion.ContentDelivery.Interop.dll
-a---        11/10/2013   9:29 PM    1149952 xmogrt.dll                                                                

    Directory: C:\tridion\deployer-Broker\bin\config

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        11/10/2013   9:29 PM       8057 cd_deployer_conf.xml
-a---          3/6/2014   4:57 PM       3896 cd_license.xml
-a---         3/17/2014   3:00 PM      18233 cd_storage_conf.xml
-a---         3/17/2014   8:58 AM       4552 logback.xml                                                               

    Directory: C:\tridion\deployer-Broker\bin\lib

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        11/10/2013   9:29 PM      62983 activation.jar
-a---        11/10/2013   9:29 PM     445288 antlr.jar
-a---        11/10/2013   9:29 PM       4467 aopalliance.jar
-a---        11/10/2013   9:29 PM      68851 cd_ambient.jar
-a---        11/10/2013   9:29 PM     261870 cd_broker.jar
-a---        11/10/2013   9:29 PM      71286 cd_cache.jar
-a---        11/10/2013   9:29 PM     288893 cd_core.jar
-a---        11/10/2013   9:29 PM     577390 cd_datalayer.jar
-a---        11/10/2013   9:29 PM     153291 cd_deployer.jar
-a---        11/10/2013   9:29 PM     125330 cd_dynamic.jar
-a---        11/10/2013   9:29 PM      30301 cd_linking.jar
-a---        11/10/2013   9:29 PM     231515 cd_model.jar
-a---        11/10/2013   9:29 PM     115099 cd_tcdl.jar
-a---        11/10/2013   9:29 PM     154957 cd_undo.jar
-a---        11/10/2013   9:29 PM      82881 cd_wai.jar
-a---        11/10/2013   9:29 PM      16130 cd_wrapper.jar
-a---        11/10/2013   9:29 PM     575389 commons-collections.jar
-a---        11/10/2013   9:29 PM     160519 commons-dbcp.jar
-a---        11/10/2013   9:29 PM      96203 commons-pool.jar
-a---        11/10/2013   9:29 PM     313898 dom4j.jar
-a---        11/10/2013   9:29 PM      38643 easylicense.jar
-a---        11/10/2013   9:29 PM    2189117 guava.jar
-a---        11/10/2013   9:29 PM      81271 hibernate-commons-annotations.jar
-a---        11/10/2013   9:29 PM    4253629 hibernate-core.jar
-a---        11/10/2013   9:29 PM     475305 hibernate-entitymanager.jar
-a---        11/10/2013   9:29 PM     102661 hibernate-jpa-2.0-api.jar
-a---        11/10/2013   9:29 PM     648253 javassist.jar
-a---        11/10/2013   9:29 PM      89967 jaxb-api.jar
-a---        11/10/2013   9:29 PM     867801 jaxb-impl.jar
-a---        11/10/2013   9:29 PM      60768 jboss-logging.jar
-a---        11/10/2013   9:29 PM      11209 jboss-transaction-api_1.1_spec.jar
-a---        11/10/2013   9:29 PM      17308 jcl-over-slf4j.jar
-a---        11/10/2013   9:29 PM      19146 jdbcpool.jar
-a---        11/10/2013   9:29 PM      51484 json-smart.jar
-a---        11/10/2013   9:29 PM     246709 logback-classic.jar
-a---        11/10/2013   9:29 PM     327911 logback-core.jar
-a---        11/10/2013   9:29 PM     278281 serializer.jar
-a---        11/10/2013   9:29 PM      25962 slf4j-api.jar
-a---        11/10/2013   9:29 PM     331474 spring-aop.jar
-a---        11/10/2013   9:29 PM      53079 spring-asm.jar
-a---        11/10/2013   9:29 PM     589253 spring-beans.jar
-a---        11/10/2013   9:29 PM     106819 spring-context-support.jar
-a---        11/10/2013   9:29 PM     829601 spring-context.jar
-a---        11/10/2013   9:29 PM     442400 spring-core.jar
-a---        11/10/2013   9:29 PM     176283 spring-expression.jar
-a---        11/10/2013   9:29 PM     401762 spring-jdbc.jar
-a---        11/10/2013   9:29 PM     378235 spring-orm.jar
-a---        11/10/2013   9:29 PM     246036 spring-tx.jar
-a---         2/17/2012  11:45 AM     584207 sqljdbc4.jar
-a---        11/10/2013   9:29 PM      23346 stax-api.jar
-a---        11/10/2013   9:29 PM    3176148 xalan.jar                                                                 

    Directory: C:\tridion\deployer-Broker\log

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         3/17/2014   2:56 PM    1284686 cd_core.2014-03-17.log
-a---         3/17/2014   2:56 PM     394916 cd_deployer.2014-03-17.log
-a---         3/17/2014   2:56 PM       3442 cd_monitor.2014-03-17.log
-a---         3/17/2014  10:20 AM          0 cd_preview.2014-03-17.log
-a---         3/17/2014   2:56 PM      14790 cd_transport.2014-03-17.log

Working with Tridion 2011 is a breath of fresh air – and sometimes from unexpected places. Today I was working with the new Content Delivery API and had a refreshingly light feeling.  I was immediately comfortable with the Criteria objects and the new possibilities. It just feels right.

Tridion Broker Query – Get item based on Metadata from all Publications

In Tridion 5.3 I have a query that finds a product based on the SKU in the Metadata for 1 Publication.  Now I have a need to get all instances of the Component for all Publications.  Using Tridion 5.3 we solved this for 1 Publication with a SearchQuery like the one below, but I could not find a way in Tridion 5.3  to query the Broker and all Publications for 1 Component using a Metadata query.  Using Tridion 2011 for getting all published instances, regardless of Publication, is very easy.

Tridion 5.3 Broker Query:

<%@ page import="com.tridion.dcp.*"%>
<%@ page import="com.tridion.dcp.filters.*"%>
<%@ page import="com.tridion.dcp.filters.query.*"%>
<%@ page import="com.tridion.broker.components.meta.*"%>
<%@ page import="com.tridion.util.*"%>
<%@ page import="com.tridion.meta.*"%>
<%
SearchFilter filt = new SearchFilter(publicationURI);
Query q = new Query();
String[] results = null;
strCustomQuery = "(KEY_NAME = '" + key + "' AND KEY_STRING_VALUE = '" + value + "')");
results = filt.match(q.toString(), strCustomQuery, ComponentMetaHome.FIELD_CREATION_DATE + "=asc", 100);

ComponentPresentationFactory cpFactory = new ComponentPresentationFactory(publicationURI);
ComponentMetaFactory componentMetaFactory = new ComponentMetaFactory(publicationURI);
if (results != null) {
	int i = 0;
	for (String result : results) {
		tcmURI = new TCMURI(result);
		ComponentPresentation cp = cpFactory.getComponentPresentationWithLowestPriority(tcmURI.getItemId());
		out.println(cp.getContent());
	}
}
%>

Tridion 2011, All Publications:

<%@ page language="java" contentType="texthtml; charset=UTF-8"%>
<%@page import="com.tridion.broker.StorageException,
com.tridion.broker.querying.*,
com.tridion.broker.querying.criteria.*,
com.tridion.broker.querying.criteria.categorization.*,
com.tridion.broker.querying.criteria.content.*,
com.tridion.broker.querying.criteria.metadata.*,
com.tridion.broker.querying.criteria.operators.*,
com.tridion.broker.querying.criteria.taxonomy.*,
com.tridion.broker.querying.filter.LimitFilter,
com.tridion.broker.querying.sorting.SortParameter"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
     <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
          <title></title>
     </head>
<%
String sku = "1EX0.031.03";
String fieldName = "article_number";

//Create query
Query myQuery = new Query();

Criteria myCriteria = null;
CustomMetaKeyCriteria metaField = new CustomMetaKeyCriteria(fieldName);
CustomMetaValueCriteria customMeta = new CustomMetaValueCriteria(sku);

// glue the metadata together
AndCriteria fieldCriteria = new AndCriteria(customMeta, metaField);
myCriteria = fieldCriteria;
myQuery.setCriteria(myCriteria);

// Sort it
SortParameter sortParameter = new SortParameter(SortParameter.ITEMS_TITLE, SortParameter.ASCENDING);
myQuery.addSorting(sortParameter);

// Get results
myQuery.setResultFilter(new LimitFilter(100));

// Display
String[] itemURIs = myQuery.executeQuery();
String strOutput = "";
for (int i = 0; i < itemURIs.length; i++) {
	strOutput += itemURIs[i] + ", ";
}
%>
<body>
	output = <%=strOutput%>
</body>
</html>

Tridion 2011, 1 Publication (Code borrowed from Tridion Live Documentation with slight modifications)

<%@ page language="java" contentType="texthtml; charset=UTF-8"%>
<%@page import="com.tridion.broker.StorageException,
com.tridion.broker.querying.*,
com.tridion.broker.querying.criteria.*,
com.tridion.broker.querying.criteria.categorization.*,
com.tridion.broker.querying.criteria.content.*,
com.tridion.broker.querying.criteria.metadata.*,
com.tridion.broker.querying.criteria.operators.*,
com.tridion.broker.querying.criteria.taxonomy.*,
com.tridion.broker.querying.filter.LimitFilter,
com.tridion.broker.querying.sorting.SortParameter"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
     <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
          <title></title>
     </head>
<%
int iPublicationID = 129;
String sku = "1EX0.031.03";
String fieldName = "article_number";

//Create query
Query myQuery = new Query();

Criteria myCriteria = null;
PublicationCriteria pubCriteria = new PublicationCriteria(iPublicationID);
CustomMetaKeyCriteria metaField = new CustomMetaKeyCriteria(fieldName);
CustomMetaValueCriteria customMeta = new CustomMetaValueCriteria(sku);

// glue the metadata together
AndCriteria fieldCriteria = new AndCriteria(customMeta, metaField);
AndCriteria allCriteria = new AndCriteria(fieldCriteria, pubCriteria);
myCriteria = allCriteria;
myQuery.setCriteria(myCriteria);

// Sort it
SortParameter sortParameter = new SortParameter(SortParameter.ITEMS_TITLE, SortParameter.ASCENDING);
myQuery.addSorting(sortParameter);

// Get results
myQuery.setResultFilter(new LimitFilter(100));

// Display
String[] itemURIs = myQuery.executeQuery();
String strOutput = "";
for (int i = 0; i < itemURIs.length; i++) {
	strOutput += itemURIs[i] + ", ";
}%>
<body>
	output = <%=strOutput%>
</body>
</html>

Helpful links:

Summary:

Tridion has opened a can of awesome sauce and spread it liberally over the new Tridion 2011 Content Delivery API. Marvel at the amount of Criteria available and prepare for the new possibilities it provides. Definitely worth a serious look when you upgrade – don’t leave your SearchFilter queries in there because you can – do yourself a favor and migrate that code right now to use the new API.