Expand my Community achievements bar.

SOLVED

InputStreamPassivationHandler / OutputService class not found

Avatar

Community Advisor

Hi All, I'm trying to generate PDF using XDP and XML input streams. Below is the piece of code used to generate documents & PDF    

@Reference     private OutputService outputService;   

1.    InputStream xdpIS = xdpRendition.getStream();    // Get XDP input steam and assign it to xdpIS object.  

2.    InputStream xmlIS = new ByteArrayInputStream(xmlStr.getBytes());    // Get XML input steam     

3.    Document xdpDocument = new Document(xdpIS);     

4.    Document xmlDocument = new Document(xmlIS);            

com.adobe.fd.output.api.PDFOutputOptions pdfOptions = new com.adobe.fd.output.api.PDFOutputOptions();     pdfOptions.setAcrobatVersion(com.adobe.fd.output.api.AcrobatVersion.Acrobat_11);   

com.adobe.aemfd.docmanager.Document generatedDocument;

try {

     generatedDocument = outputService.generatePDFOutput(xdpDocument,xmlDocument,pdfOptions);

     generatedDocument.getInputStream().toString();

     generatedDocument.copyToFile(new java.io.File("C:\\migration\\files\\test.pdf"));

} catch (OutputServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); }

Exception:

1.  Getting java.lang.NoClassDefFoundError: com/adobe/aemfd/docmanager/internal/passivation/InputStreamPassivationHandler  at Line number 3. Also, getting OutputService class not found exception.

I've added below dependencies in pom.xml

<dependency>

<groupId>com.adobe.aemds.core</groupId>

<artifactId>adobe-aemds-core-docmanager</artifactId>

<version>1.4.6</version>

<scope>provided</scope>

</dependency>

<!-- https://mvnrepository.com/artifact/com.adobe.aem/aem-api -->

<dependency>

<groupId>com.adobe.aem</groupId>

<artifactId>aem-api</artifactId>

<version>6.0.0.1</version>

<scope>provided</scope>

</dependency>

<dependency>

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

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

<version>1.0.2</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.adobe.livecycle</groupId>

<artifactId>adobe-lc-forms-bedrock-connector</artifactId>

<version>6.0.44</version>

<scope>provided</scope>

</dependency>

Please advise If we need to add any other dependencies to resolve the issues. FYI, when I use the same code in jsp, it's working fine. Thanks In advance Siva

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The issue has been resolved after adding following dependency in core/pom.xml

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

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

<scope>provided</scope>

</dependency>

View solution in original post

7 Replies

Avatar

Community Advisor

I've added below dependency and it resolved java.lang.NoClassDefFoundError: com/adobe/aemfd/docmanager/internal/passivation/InputStreamPassivationHandler  Exception.

<dependency>

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

<artifactId>adobe-aemfd-assembler</artifactId>

<version>2.0.6</version>

<scope>provided</scope>

</dependency>

But I still see the below class not found exception. Please let me know the dependency to be added to resolve the issue.

Exception:  java.lang.ClassNotFoundException: com.adobe.fd.output.api.OutputServiceException

Avatar

Level 10

Are you following an online doc you can point the community too so this can be reproduced?

Avatar

Community Advisor

I've followed below online doc. Please refer generatePDFPOutput section.

AEM 6.2 Forms Help | Using AEM Document Services Programmatically

I see below error in the error log.

[com.AEMWrapper(3499)] Failure loooking up method bindOutputService(org.osgi.framework.ServiceReference) in class class com.AEMWrapper. Assuming no such method. (java.lang.NoClassDefFoundError: com/adobe/fd/output/api/OutputServiceException)

java.lang.NoClassDefFoundError: com/adobe/fd/output/api/OutputServiceException

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Unknown Source)

at java.lang.Class.getDeclaredMethod(Unknown Source)

at org.apache.felix.scr.impl.inject.BaseMethod.getMethod(BaseMethod.java:318)

at org.apache.felix.scr.impl.inject.BindMethod.getServiceReferenceMethod(BindMethod.java:394)

at org.apache.felix.scr.impl.inject.BindMethod.doFindMethod(BindMethod.java:115)

at org.apache.felix.scr.impl.inject.BaseMethod.findMethod(BaseMethod.java:173)

at org.apache.felix.scr.impl.inject.BaseMethod.access$400(BaseMethod.java:39)

at org.apache.felix.scr.impl.inject.BaseMethod$NotResolved.resolve(BaseMethod.java:560)

at org.apache.felix.scr.impl.inject.BaseMethod$NotResolved.methodExists(BaseMethod.java:582)

at org.apache.felix.scr.impl.inject.BaseMethod.methodExists(BaseMethod.java:515)

at org.apache.felix.scr.impl.inject.BindMethod.getServiceObject(BindMethod.java:645)

at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2201)

at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.prebind(DependencyManager.java:1118)

at org.apache.felix.scr.impl.manager.DependencyManager.prebind(DependencyManager.java:1520)

at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractComponentManager.java:1006)

at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:859)

at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823)

at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)

at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)

at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:344)

at org.apache.felix.framework.Felix.getService(Felix.java:3700)

at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)

at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:72)

at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:1461)

at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:1434)

at org.apache.felix.scr.impl.manager.ComponentContextImpl.locateService(ComponentContextImpl.java:147)

at org.apache.sling.servlets.resolver.internal.SlingServletResolver.createServlet(SlingServletResolver.java:968)

at org.apache.sling.servlets.resolver.internal.SlingServletResolver.bindServlet(SlingServletResolver.java:930)

at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)

at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)

at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)

at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)

at org.apache.felix.scr.impl.inject.BindMethod.invoke(BindMethod.java:655)

at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1722)

at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1699)

at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:372)

at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:320)

at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:291)

at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1215)

at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1136)

at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:945)

at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:881)

at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1167)

at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:127)

at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)

at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)

at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)

at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4558)

at org.apache.felix.framework.Felix.registerService(Felix.java:3550)

at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)

at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:887)

at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:874)

at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:132)

at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:941)

at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:741)

at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:675)

at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:430)

at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:657)

at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:341)

at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:390)

at org.apache.felix.scr.impl.Activator.access$200(Activator.java:54)

at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:265)

at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)

at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)

at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)

at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415)

at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)

at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)

at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)

at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)

at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517)

at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4542)

at org.apache.felix.framework.Felix.startBundle(Felix.java:2173)

at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)

at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)

at org.apache.sling.installer.core.impl.tasks.BundleStartTask.execute(BundleStartTask.java:97)

at org.apache.sling.installer.core.impl.OsgiInstallerImpl.doExecuteTasks(OsgiInstallerImpl.java:894)

at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:729)

at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:286)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: com.adobe.fd.output.api.OutputServiceException not found by ezAccess-aemwrapper.core [728]

at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)

at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)

at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 84 common frames omitted

Thanks

Siva

Avatar

Level 10

Looks like something is missing. Did you install the Doc Services bundle?

Also - watch this webinar about Doc Services - ATACE 6_21_16 AEM Forms dive into Document Services

Avatar

Level 10

We will write some HELPX community articles on these use cases - make sure this code works.

Avatar

Community Advisor

Thanks for the detailed information. I've followed the resource and here are my observations. I see the bundle 'Adobe XFA Forms Bedrock Connector) exist in felix consle which has com.adobe.fd.output.api.OutputService . Also, I'm able to get the OutputService from JSP using sling object. com.adobe.fd.output.api.OutputService outputService = sling.getService(com.adobe.fd.output.api.OutputService.class); But I'm getting exception only When I try to get the OutputService in servlet using @Reference. @Reference private OutputService outputService; Please advise.

Avatar

Correct answer by
Community Advisor

The issue has been resolved after adding following dependency in core/pom.xml

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

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

<scope>provided</scope>

</dependency>