当前位置: 首页 > 知识库问答 >
问题:

在OSGI/Adobe AEM中使用Rome RSS

戴原
2023-03-14

我在使用rome库创建RSS Feeds时遇到了一个问题。https://rometools.github.io/如果我只是将lib添加到我的pom.xml并将其部署到AEM实例,然后调用一个应该使用该库的servlet,它就会失败...我无法调试到servlet。

我认为这是一个类加载问题,在罗马工具的网站上有一个将系统属性“rome.pluginmanager.useloadclass”设置为true的提示。我该如何实现这一点?只是作为启动参数,还是有办法在apache felix控制台或AEM内部的另一个地方?

在错误日志中,我得到了以下消息:

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.ja va:2137)
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.prebind(Depend encyManager.java:1048)
at org.apache.felix.scr.impl.manager.DependencyManager.prebind(DependencyManager.java:1457)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractCo mponentManager.java:983)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleCompone ntManager.java:812)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManage r.java:774)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistratio nImpl.java:347)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.jav a: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:139 6)
at org.apache.felix.scr.impl.manager.DependencyManager.getService(DependencyManager.java:137 0)
at org.apache.felix.scr.impl.manager.ComponentContextImpl.locateService(ComponentContextImpl .java:135)
at org.apache.sling.servlets.resolver.internal.SlingServletResolver.createServlet(SlingServl etResolver.java:979)
at org.apache.sling.servlets.resolver.internal.SlingServletResolver.bindServlet(SlingServlet Resolver.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.ja va:1636)
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponent Manager.java:370)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedServic e(DependencyManager.java:319)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedServic e(DependencyManager.java:295)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.j ava:1215)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.j ava:1136)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTrack er.java:945)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.jav a:881)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.ja va:1167)
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComp onentActivator.java:120)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispat cher.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(AbstractComponentMa nager.java:869)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentMa nager.java:857)
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationMana ger.java:133)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractCompon entManager.java:915)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractCompo nentManager.java:715)
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(D ependencyManager.java:954)
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(D ependencyManager.java:915)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.j ava:1215)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.j ava:1136)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTrack er.java:945)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.jav a:881)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.ja va:1167)
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComp onentActivator.java:120)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispat cher.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(AbstractComponentMa nager.java:869)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentMa nager.java:857)
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationMana ger.java:133)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractCompon entManager.java:915)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractCompo nentManager.java:715)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManage r.java:399)
at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(Configurabl eComponentHolder.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:25 9)
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(EventDispatc her.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:9 7)
at org.apache.sling.installer.core.impl.OsgiInstallerImpl.doExecuteTasks(OsgiInstallerImpl.j ava:894)
at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.jav a: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

解决方案:

将您的罗马库也添加到您pom.xml的嵌入式依赖项中

<Embed-Dependency>
              rome,
              rome-utils,
              jdom2
 </Embed-Dependency>

共有1个答案

江阳羽
2023-03-14

解决方案:

将您的罗马库也添加到您pom.xml的嵌入式依赖项中

<Embed-Dependency>
              rome,
              rome-utils,
              jdom2
 </Embed-Dependency>
 类似资料:
  • 我试图构建一个使用嵌入式OrientDB(当前为“Memory:”)图形数据库的应用程序。我用的是OrientDB2.2 orientdb-graphdb不应该依赖于一个合适的包,或者包括并导出类吗?

  • 我的问题在于在前端包中使用/消费来自下游节点包的服务(例如osgi-mobile使用/消费来自osgi-downstreamnode1的服务)。 我目前正在Eclipse Mars中构建它们,由于没有将整个osgi-downstreamnode1包打包到一个JAR中,并将其导入osgi-mobile包,所以我似乎不知道如何在Eclipse中引用这些包,以及如何让osgi-mobile包在运行时调用

  • 作为最新的Apache POI3.11,JAR不是bundle,让POI在OSGi中工作的最佳方式是什么? 我尝试了两种方法: 将JAR直接嵌入到唯一使用它们的包中 使用预包装为包的POI罐子 注意:至少还需要和,但它们已经是bundle了。 使用预包装的JAR,我尝试使用3.92。这还需要,所以我使用了预包装的,但这至少需要1.0版本,我的JVM/Felix OSGi将其宣传为“only”版本。

  • 我想使用这个java库[1]enj-library 我将这个库编译成jar,然后在eclipse下创建了一个新的插件项目“来自现有JAR档案的插件” 然后我试着将它添加到我的包,但它没有 2.我需要它作为添加包,但我得到了 3.我添加了类路径,我的包开始了,但我得到了类未找到异常 [1]https://github.com/dog 网关/enj-library 我在OSGI捆绑包包含这个库如何?

  • 问题内容: 我目前正在尝试获取一个包含Service Factory运行的简单捆绑包。 这是我的工厂班级: 这是我应该由工厂创建的服务: 最后是OSGI-INF / component.xml 如果我在春分内运行测试包(A,B和C),则会收到以下错误: 我找不到有关使用Internet上的组件定义中声明的ServiceFeactories的太多信息。甚至《 OSGi和Equinox》一书也没有告诉

  • 此代码会导致具有以下堆栈跟踪的空指针异常: 查看ContextFinder的源代码,我可以看到第129行的必须为空: 我认为问题可能是我的模块依赖于JAXB-API2.2.11,但是jaxb-impl类是由rt.jar在运行时提供的,并且可能比2.2.11新,因为Liferay DXP运行在JDK1.8上。为了解决这个问题,我尝试在osgi模块中包含jaxb-impl.jar2.2.11作为一个依