VERIFIED SOLUTION i

Resolve error "FailedToRetrieveTemplateInformationException: Unable to retrieve template" in EngageOne NA Batch

Product Feature: Template Management

Issue

When attempting to run NA-Batch with a template called e.g. 'EO_Template', you get the error:
com.pb.engageone.server.batch.exception.FailedToRetrieveTemplateInformationException: Unable to retrieve template: EO_Template.
...
Caused by: com.pb.engageone.server.tds.api.RepositoryApiException: org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.


In the system logs you may find entries similar to this:
--------------------------------------------------
[Apr 01 20:07:55]|ERROR|CommandLineRunner|[NA Batch Main Thread]|Input Answer Id: N/A|Input File Name: N/A|Error encountered
com.pb.engageone.server.batch.exception.FailedToRetrieveTemplateInformationException: Unable to retrieve template: kuhi_test.
    at com.pb.engageone.server.batch.na.dao.CachingTemplateDaoEjb.retrieveTemplate(Unknown Source)
    at com.pb.engageone.server.batch.na.gather.reader.DefaultBatchItemReader.retrieveTemplate(Unknown Source)
    at com.pb.engageone.server.batch.na.gather.reader.DefaultBatchItemReader.handleDataFile(Unknown Source)
    at com.pb.engageone.server.batch.na.gather.reader.DefaultBatchItemReader.read(Unknown Source)
    at com.pb.engageone.server.batch.na.BatchProgramImpl.doRun(Unknown Source)
    at com.pb.engageone.server.batch.na.BatchProgramTemplate.run(Unknown Source)
    at com.pb.engageone.server.batch.na.runner.CommandLineRunner.start(Unknown Source)
    at com.pb.engageone.server.batch.na.runner.CommandLineRunner.main(Unknown Source)
Caused by: com.pb.engageone.server.batch.exception.FailedToRetrieveTemplateInformationException: Unable to retrieve template: kuhi_test.
    at com.pb.engageone.server.batch.na.dao.CachingTemplateDaoEjb.getTemplate(Unknown Source)
    at com.pb.engageone.server.batch.na.dao.CachingTemplateDaoEjb.retrieveTemplate(Unknown Source)
    ... 7 more
Caused by: com.pb.engageone.server.tds.api.RepositoryApiException: org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at com.pb.engageone.server.tds.api.RepositoryApi.getTemplateInformation(Unknown Source)
    at com.pb.engageone.server.tds.api.RepositoryApi.getTemplateInformation(Unknown Source)
    at com.pb.engageone.server.tds.api.ejb.RepositoryBean.getTemplateInformation(Unknown Source)
    at com.pb.engageone.server.tds.api.ejb.EJSRemote0SLRepositoryBean_ace38ac3.getTemplateInformation(EJSRemote0SLRepositoryBean_ace38ac3.java)
    at com.pb.engageone.server.tds.api.ejb._EJSRemote0SLRepositoryBean_ace38ac3_Tie.getTemplateInformation__CORBA_WStringValue__CORBA_WStringValue(_EJSRemote0SLRepositoryBean_ace38ac3_Tie.java)
    at com.pb.engageone.server.tds.api.ejb._EJSRemote0SLRepositoryBean_ace38ac3_Tie._invoke(_EJSRemote0SLRepositoryBean_ace38ac3_Tie.java)
    at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:622)
    at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:475)
    at com.ibm.rmi.iiop.ORB.process(ORB.java:504)
    at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
    at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2771)
    at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2640)
    at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
    at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)

    at com.pb.engageone.server.tds.api.RepositoryApi.getTemplateInformation(Unknown Source)
    at com.pb.engageone.server.tds.api.ejb.RepositoryBean.getTemplateInformation(Unknown Source)
    at com.pb.engageone.server.tds.api.ejb.EJSRemote0SLRepositoryBean_ace38ac3.getTemplateInformation(EJSRemote0SLRepositoryBean_ace38ac3.java)
    at com.pb.engageone.server.tds.api.ejb._EJSRemote0SLRepositoryBean_ace38ac3_Tie.getTemplateInformation__CORBA_WStringValue__CORBA_WStringValue(_EJSRemote0SLRepositoryBean_ace38ac3_Tie.java)
    at com.pb.engageone.server.tds.api.ejb._EJSRemote0SLRepositoryBean_ace38ac3_Tie._invoke(_EJSRemote0SLRepositoryBean_ace38ac3_Tie.java)
    at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:622)
    at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:475)
    at com.ibm.rmi.iiop.ORB.process(ORB.java:504)
    at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
    at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2771)
    at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2640)
    at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
    at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
[Apr 01 20:07:55]|INFO |CommandLineRunner|[NA Batch Main Thread]|Input Answer Id: N/A|Input File Name: N/A|Batch elapsed time: 3.282 seconds

--------------------------------------------------

Cause

This can be caused by the presence of a 'special' character such as (e.g. \ < > & " ' % + *) in the name of the template or in one of the publishable Active Contents.

EngageOne has issues with the encoding of the character as an entity when writing the name to an internal XML file. The template_master.xml will contain one or more lines containing an XML entity representation of one of these high-byte characters like the following:
      <Res type="ACTCONT" name="OG 165 MD (04-12) Directors &amp; Officers Liabil Excln Endo" guid="64995D9854B64BDCB571EA204AE8AFBA" version="7ED8E8CFA26149FC90B8A0E6EED58377" />

Or if it has been exported, then the xml with the same name as the template will have something like this:
      <Res guid="64995D9854B64BDCB571EA204AE8AFBA" name="OG 165 MD (04-12) Directors &amp; Officers Liabil Excln Endo" type="ACTCONT" version="7ED8E8CFA26149FC90B8A0E6EED58377"/>

This is a known restriction in EngageOne. This is documented in the EngageOne 3.1 Release Notes:
"The following special characters are not supported in template names:
\ < > & " ' % + *
Other issues with special characters also occur. For example, if you copy and
paste a folder name containing the percent symbol (%) the system creates the
folder, but displays an error. Also, folder names that include the plus symbol (+)
are saved, but the plus symbol does not get saved in the folder name.
"

Resolution

UPDATED: November 13, 2017
To fix this:
  1. Rename the template and any active contents containing those characters in their names
  2. Republish the affected objects (templates and ACs) and all objects referencing them.
A quick method for republishing all the ACs is to use the command-line publish as described in the Knowledge Article: Publishing all Active Contents for a given EngageOne template on the command line