Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

OutputService.generatePDFOutput connection to failed Service

Avatar

Level 2

We are attempting to generate pdf document, using OutputService.generatePDFOutput() getting connection to failed Service error. Below are our environment details

Environment : AEM  6.3.2

Forms package : AEM-Forms-6.3.2.0-LX-4.1.64

Server : Linux

in the POM added below dependency

<dependency>

    <groupId>com.adobe.aemfd</groupId>

    <artifactId>aemfd-client-sdk</artifactId>

    <version>6.3.0</version>

    <scope>provided</scope>

</dependency>

Exception :

com.adobe.fd.output.internal.exception.OutputServiceException: AEM_OUT_001_003:Unexpected Exception: AEM_OUT_001_003:Unexpected Exception: Connection to failed service.

at com.adobe.fd.output.impl.OutputServiceImpl.generatePDFOutput(OutputServiceImpl.java:84)

at com.xxx.core.servlet.MSServicesServlet.generatePDFOutput(MSServicesServlet.java:590)

at com.xxx.core.servlet.MSServicesServlet.doPost(MSServicesServlet.java:291)

at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:149)

at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:346)

at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:378)

at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552)

at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)

at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:138)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:375)

at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:190)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)

at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:71)

at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:109)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:126)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

...frames omitted

Caused by: com.adobe.fd.output.internal.exception.OutputServiceException: AEM_OUT_001_003:Unexpected Exception: Connection to failed service.

at com.adobe.fd.output.impl.OutputServiceImpl.generatePDFOutput(OutputServiceImpl.java:117)

at com.adobe.fd.output.impl.OutputServiceImpl.generatePDFOutput(OutputServiceImpl.java:82)

... 136 common frames omitted

Caused by: java.lang.IllegalStateException: Connection to failed service.

at com.adobe.service.ResourcePooler.allocateResource(ResourcePooler.java:104)

at com.adobe.service.ConnectionFactoryManagerPeer.getConnectionResourceFromPool(ConnectionFactoryManagerPeer.java:76)

at com.adobe.service.ConnectionFactoryManagerPeerImpl.getConnection(ConnectionFactoryManagerPeerImpl.java:155)

at com.adobe.service.impl.PlatformPeerImpl.lookup(PlatformPeerImpl.java:49)

at com.adobe.forms.aem.impl.XFANativeServiceImpl.paExecute(XFANativeServiceImpl.java:115)

at com.adobe.forms.aem.impl.XFANativeServiceImpl.paExecute(XFANativeServiceImpl.java:430)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$paExecute$2$$anonfun$2.apply(XMLFormServiceImpl.scala:167)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$paExecute$2$$anonfun$2.apply(XMLFormServiceImpl.scala:167)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$paExecute$2.apply(XMLFormServiceImpl.scala:166)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$paExecute$2.apply(XMLFormServiceImpl.scala:158)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl.paExecute(XMLFormServiceImpl.scala:156)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$com$adobe$forms$xtg$impl$XMLFormServiceImpl$$resolveTemplateCacheGen$2.apply(XMLFormServiceImpl.scala:192)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$com$adobe$forms$xtg$impl$XMLFormServiceImpl$$resolveTemplateCacheGen$2.apply(XMLFormServiceImpl.scala:187)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl.com$adobe$forms$xtg$impl$XMLFormServiceImpl$$resolveTemplateCacheGen(XMLFormServiceImpl.scala:187)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$resolveTemplate$2$$anonfun$apply$2.apply(XMLFormServiceImpl.scala:281)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$resolveTemplate$2$$anonfun$apply$2.apply(XMLFormServiceImpl.scala:281)

at com.adobe.forms.cache.ResourceCache$$anonfun$getOrElseUpdate$2.apply(ResourceCache.scala:107)

at com.adobe.forms.cache.ResourceCache$$anonfun$getOrElseUpdate$2.apply(ResourceCache.scala:97)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.cache.ResourceCache$class.getOrElseUpdate(ResourceCache.scala:97)

at com.adobe.forms.cache.impl.PreRenderCacheImpl.getOrElseUpdate(PreRenderCacheImpl.scala:35)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$resolveTemplate$2.apply(XMLFormServiceImpl.scala:281)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl$$anonfun$resolveTemplate$2.apply(XMLFormServiceImpl.scala:280)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.xtg.impl.XMLFormServiceImpl.resolveTemplate(XMLFormServiceImpl.scala:279)

at com.adobe.forms.service.impl.LCOptionsXFAInterpreterImpl$$anonfun$resolvedTemplate$2.apply(LCOptionsXFAInterpreterImpl.scala:135)

at com.adobe.forms.service.impl.LCOptionsXFAInterpreterImpl$$anonfun$resolvedTemplate$2.apply(LCOptionsXFAInterpreterImpl.scala:134)

at com.adobe.forms.logging.PerfLogger$class.measure(PerfLogger.scala:60)

at com.adobe.forms.logging.PerfLogger$.measure(PerfLogger.scala:33)

at com.adobe.forms.service.impl.LCOptionsXFAInterpreterImpl.resolvedTemplate(LCOptionsXFAInterpreterImpl.scala:134)

at com.adobe.forms.service.impl.AEMFormsHelperServiceImpl.resolvedTemplate(AEMFormsHelperServiceImpl.scala:53)

at com.adobe.fd.output.impl.OutputServiceImpl.generatePDFOutput(OutputServiceImpl.java:114)

I am suspecting aemfd-client-sdk dependency version in the POM is not the correct one, am not sure.

Thanks,

Chandra

1 Accepted Solution

Avatar

Correct answer by
Employee
17 Replies

Avatar

Level 10

Can you post the code you are using.

Avatar

Level 10

I am testing this use case and will post back results.

Avatar

Correct answer by
Employee

Avatar

Level 2

Sorry for late reply, Below is the sample code, how we are invoking generatePDFOutput

InputStream targetStream = new ByteArrayInputStream(xml.getBytes()); 

PDFOutputOptions option = new PDFOutputOptions();   

  ...Adding options

Document pdfDoc = outputService.generatePDFOutput(document,new Document(targetStream),option);

Thanks,

Chandra

Avatar

Level 4
@smacdonald2008, we're doing the same. `return outputService.generatePDFOutput(templatePath, inputXml, outputOptions);` where OutputService is a Reference to com.adobe.fd.output.api.OutputService. We're seeing the same error pasted by @nchandra. This works on a windows machine, not on my MacOSX. We're using AEM 6.5.3 and adobe-aemfd-win-pkg-6.0.122.zip. cc: @mayankg

Avatar

Level 10

I will post a video shortly of my results.

Avatar

Level 10

Got it working - a video will be posted very soon.

Avatar

Level 10

I successfully invoked the AEM Forms Output Service for J2EE. It created a PDF as shown here:

Code we used in video...

package com.adobe.community;

import java.io.File;

import java.io.FileInputStream;

import java.util.Properties;

import com.adobe.livecycle.output.client.*;

import java.util.*;

import java.io.File;

import java.io.FileInputStream;

import com.adobe.idp.Document;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

public class CreatePDFDocumentSOAP {

public static void main(String[] args) {

     

     try{

     //Set connection properties required to invoke LiveCycle                                

     Properties connectionProps = new Properties();

     connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http://localhost:8080"); 

     connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);              

     connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

     connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");

     connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

                 

     //Create a ServiceClientFactory object

     ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

             

     //Create an OutputClient object

     OutputClient outClient = new OutputClient(myFactory); 

                     

     //Reference form data                        

     FileInputStream fileInputStream = new FileInputStream("C:\\Adobe\\Loan.xml");    

     Document inXMData = new Document (fileInputStream);

             

     //Set PDF run-time options    

     PDFOutputOptionsSpec outputOptions = new PDFOutputOptionsSpec();

     outputOptions.setFileURI("C:\\Adobe\\Loan.pdf");

         

     //Set rendering run-time options

     RenderOptionsSpec pdfOptions = new RenderOptionsSpec(); 

     pdfOptions.setLinearizedPDF(true);

     pdfOptions.setAcrobatVersion(AcrobatVersion.Acrobat_9);

                     

     //Create a PDF document            

     OutputResult outputDocument = outClient.generatePDFOutput(

         TransformationFormat.PDF,

         "Loan.xdp",

         "C:\\Adobe",

         outputOptions,

         pdfOptions,

         inXMData

     );

             

     //Retrieve the results of the operation

     Document metaData = outputDocument.getStatusDoc();

     File myFile = new File("C:\\Adobe\\Output.xml");

     metaData.copyToFile(myFile);

     }

     catch (Exception ee)

     {

         ee.printStackTrace();

     }

}

}

Avatar

Level 10

This uses AEM Forms for J2EE. We are going to port this example as well to AEM Forms for OSGi,

Avatar

Level 2

smacdonald2008​   Thank you, I did some tests found it is working in Windows machines and not working on Linux machines. We missed the additional requirements part, when we are setting the AEM forms in the Linux machines ,Thank you mayankg​  for lettign me know. We are working with our infrastructure team for adding those libraries.

I will post it here results once we update the libraries.

Thanks,

Chandra

Avatar

Level 1

Hi, have you ported this yet to OSGI?

Avatar

Level 2

I think I have a similar problem, but i can't find "Additional requirements" under your link. Have it been moved?

Avatar

Level 4

@nchandra/ @LincolnDlamini did either of you find the cause for this error?

Avatar

Level 1
@anjali_biddanda , the solution for me was to explicitly install 32 bit linux system libraries i.e expat.i686 , libxcb.i686 etc...

Avatar

Level 4
Thanks @LincolnDlamini. That was very helpful. However, I'm on macOS 10.15 Catalina, which unlike earlier versions which supported 32-bit apps, Catalina has all 32-bit code ripped out. My only option is to run Parallels or a VM with the older macOS 10.14.6.

Avatar

Level 1
@anjali_biddanda , I am also running this on Parallels CentOS image, I have not tested this on macOS