Skip to main content
nchandra
Level 2
Aug 28, 2018 2:41 PM UTC
Solved

OutputService.generatePDFOutput connection to failed Service

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
MayankGu9Accepted solution
Adobe Employee
Aug 28, 2018 10:26 PM UTC

17 replies

smacdonald2008
Level 10
Aug 28, 2018 2:51 PM UTC

Can you post the code you are using.

Translate
smacdonald2008
Level 10
Aug 28, 2018 5:07 PM UTC

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

Translate
MayankGu9Adobe EmployeeAccepted solution
Adobe Employee
Aug 28, 2018 10:26 PM UTC
nchandra
nchandraAuthor
Level 2
Aug 29, 2018 1:50 PM UTC

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

Translate
anjali_biddanda
Level 4
Dec 22, 2020 10:31 PM UTC
@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: @mayankgu9
Translate
smacdonald2008
Level 10
Aug 29, 2018 2:04 PM UTC

I will post a video shortly of my results.

Translate
smacdonald2008
Level 10
Aug 29, 2018 4:20 PM UTC

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

Translate
smacdonald2008
Level 10
Aug 29, 2018 5:30 PM UTC

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();

     }

}

}

Translate
smacdonald2008
Level 10
Aug 29, 2018 5:44 PM UTC

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

Translate
nchandra
nchandraAuthor
Level 2
Aug 29, 2018 6:25 PM UTC

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

Translate
Aug 26, 2019 10:31 AM UTC

Hi, have you ported this yet to OSGI?

Translate