OutputService.generatePDFOutput connection to failed Service

Avatar

Avatar

nchandra

Avatar

nchandra

nchandra

28-08-2018

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

mayankg

Employee

Avatar

mayankg

Employee

mayankg
Employee

28-08-2018

Answers (10)

Answers (10)

Avatar

Avatar

Ron_PreForm_IT

Avatar

Ron_PreForm_IT

Ron_PreForm_IT

13-09-2019

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

Avatar

Avatar

Tys_Seyffert1

Avatar

Tys_Seyffert1

Tys_Seyffert1

26-08-2019

Hi, have you ported this yet to OSGI?

Avatar

Avatar

nchandra

Avatar

nchandra

nchandra

29-08-2018

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

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

29-08-2018

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

29-08-2018

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

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

29-08-2018

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

29-08-2018

I will post a video shortly of my results.

Avatar

Avatar

nchandra

Avatar

nchandra

nchandra

29-08-2018

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

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

28-08-2018

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

28-08-2018

Can you post the code you are using.