Problem using Rome for RSS

tim-schwalbe-NZ

14-11-2017

Hello guys,

I ran into a problem using the rome library for creating RSS Feeds. https://rometools.github.io/

If I just add the lib to my pom.xml and deploy it to an AEM instance and call a servlet which should use the library it just fails. Iam unable to debug into the servlet.

I think it is a class loading issue and on the website of the rome tools is a hint to set the system property 'rome.pluginmanager.useloadclass' to true. How can I achieve this? just as startup parameter or is there a way to do in inside apache felix console or another place inside AEM?

In the error log i got the following message:

failure loooking up method bindRssFeed(org.osgi.framework.ServiceReference) in class class com.xxx.aem.relaunch.servlets.rssfeed.RssFeedServlet. Assuming no such method. (java.lang.NoClassDefFoundError: com/rometools/rome/io/FeedException)

java.lang.NoClassDefFoundError: com/rometools/rome/io/FeedException

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.helper.BaseMethod.getMethod(BaseMethod.java:316)

at org.apache.felix.scr.impl.helper.BindMethod.getServiceReferenceMethod(BindMethod.java:392)

at org.apache.felix.scr.impl.helper.BindMethod.doFindMethod(BindMethod.java:113)

at org.apache.felix.scr.impl.helper.BaseMethod.findMethod(BaseMethod.java:171)

at org.apache.felix.scr.impl.helper.BaseMethod.access$400(BaseMethod.java:37)

at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.resolve(BaseMethod.java:558)

at org.apache.felix.scr.impl.helper.BaseMethod$NotResolved.methodExists(BaseMethod.java:580)

at org.apache.felix.scr.impl.helper.BaseMethod.methodExists(BaseMethod.java:513)

at org.apache.felix.scr.impl.helper.BindMethod.getServiceObject(BindMethod.java:643)

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

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

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

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

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

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

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:3699)

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:1396)

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

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

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

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

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

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

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

at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)

at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)

at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)

at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)

at org.apache.felix.scr.impl.helper.BindMethod.invoke(BindMethod.java:41)

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

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

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

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

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

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:120)

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:4557)

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

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

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

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

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

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

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

at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:954)

at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:915)

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:120)

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:4557)

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

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

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

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

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

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

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

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

at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:676)

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

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

at org.apache.felix.scr.impl.Activator.access$000(Activator.java:53)

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

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:4541)

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

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.rometools.rome.io.FeedException not found by com.xxx.aem.xx-com-relaunch.core

Accepted Solutions (1)

Accepted Solutions (1)

tim-schwalbe-NZ

16-11-2017

So thanks to everyone,

I solved the issue by adding the following to my pom file. Is this the right way to do?

<Embed-Dependency>

  rome,

  rome-utils,

  jdom2

</Embed-Dependency>

Answers (4)

Answers (4)

smacdonald2008

15-11-2017

What is happening here is although you are referecning the lib in your POM file to build the OSGi bunlde - you need to ALSO place the JAR file into a OSGi bunlde and deploy. An OSGi bunlde in AEM needs to export this Java API.