我开始使用 Apache Camel,我想为 camel-servlet 组件创建一个 OSGI 包。
查看骆驼网站上的文档,我找到了本教程http://camel.apache.org/tutorial-osgi-camel-part1.html,但看起来它已被弃用。查找文档,我发现所有骆驼组件都符合 OSGI 标准。
我使用 JBoss EAP 6.1 作为我的容器服务器。我部署了 camel-servlet 组件,然后转到 JBoss 管理工具中的 OSGI 选项卡。出现了一个名为org.apache.camel.camel-servlet的新服务,版本为2.10.0。当我尝试启动捆绑包时,我在日志中有以下消息:
15:45:58,624 INFO [org.jboss.as.osgi] (HttpManagementService-threads - 2) JBAS011916: Activate deferred module phase for: org.apache.camel.camel-servlet:2.10.0
15:45:58,625 ERROR [org.jboss.as.osgi] (HttpManagementService-threads - 2) JBAS011909: Management operation 'start' failed: org.osgi.framework.BundleException: JBOSGI011250: Cannot resolve bundle: org.apache.camel.camel-servlet:2.10.0
at org.jboss.as.osgi.service.BundleLifecycleIntegration$BundleLifecycleImpl.activateDeferredPhase(BundleLifecycleIntegration.java:299)
at org.jboss.as.osgi.service.BundleLifecycleIntegration$BundleLifecycleImpl.start(BundleLifecycleIntegration.java:229)
at org.jboss.osgi.framework.internal.AbstractBundleState.startWithOptions(AbstractBundleState.java:537)
at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:525)
at org.jboss.as.osgi.management.BundleResourceHandler.handleOperation(BundleResourceHandler.java:106)
at org.jboss.as.osgi.management.BundleResourceHandler.executeRuntimeStep(BundleResourceHandler.java:58)
at org.jboss.as.controller.AbstractRuntimeOnlyHandler$1.execute(AbstractRuntimeOnlyHandler.java:90) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:440) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:322) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:229) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:224) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:194) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:115) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.ModelControllerImpl$3.execute(ModelControllerImpl.java:398) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.ModelControllerImpl$3.execute(ModelControllerImpl.java:388) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.domain.http.server.DomainApiHandler.processRequest(DomainApiHandler.java:320)
at org.jboss.as.domain.http.server.DomainApiHandler.doHandle(DomainApiHandler.java:226)
at org.jboss.as.domain.http.server.DomainApiHandler.handle(DomainApiHandler.java:233)
at org.jboss.as.domain.http.server.security.SubjectAssociationHandler.handle(SubjectAssociationHandler.java:51)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78)
at org.jboss.sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:69)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81)
at org.jboss.sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:710)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78)
at org.jboss.as.domain.http.server.RealmReadinessFilter.doFilter(RealmReadinessFilter.java:47)
at org.jboss.as.domain.http.server.DmrFailureReadinessFilter.doFilter(DmrFailureReadinessFilter.java:45)
at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81)
at org.jboss.sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:682)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_51]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1]
Caused by: org.osgi.service.resolver.ResolutionException: Unable to resolve HostBundleRevision[org.apache.camel.camel-servlet:2.10.0]: missing requirement XPackageRequirement[atts={osgi.wiring.package=javax.servlet, version=[2.5,3)},[org.apache.camel.camel-servlet:2.10.0]]
at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)
at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:96)
at org.jboss.osgi.resolver.felix.StatelessResolver.resolve(StatelessResolver.java:56)
at org.jboss.osgi.framework.internal.ResolverImpl.resolveAndApply(ResolverImpl.java:137)
at org.jboss.as.osgi.service.BundleLifecycleIntegration$BundleLifecycleImpl.activateDeferredPhase(BundleLifecycleIntegration.java:296)
有一个符号名称为org.jboss.spec.javax.servlet.jboss-servlet-api_3.0_spec 的包,其位置为javax.servlet.api。
我谷歌如何将骆驼servlet部署为OSGI包,但我没有找到任何线索。