Невозможно развернуть файл Karaf kar, содержащий декларативную службу ComponentFactory OSGi - PullRequest
0 голосов
/ 31 августа 2018

Мне трудно заставить простое PoC-приложение работать в Karaf 4.2.1 и 4.0.9 (ServiceMix - 7.0.1).

Приложение пытается создать службы, используя org.osgi.service.component.ComponentFactory , но во время развертывания через формат файла функций Karaf я получаю следующую ошибку:

15:27:07.969 WARN [fileinstall-/Users/tmoreira2020/temp/apache-karaf-4.2.1/deploy] Unable to install Kar feature br.com.thiagomoreira.application/1.0.0.SNAPSHOT 
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=br.com.thiagomoreira.application)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.SNAPSHOT: missing requirement [br.com.thiagomoreira.application/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=osgi.bundle; version="[1.0.0.201808301826,1.0.0.201808301826]"; resolution:=mandatory [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active]] 
        at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?] 
        at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392) ~[?:?] 
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378) ~[?:?] 
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332) ~[?:?] 
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257) ~[?:?] 
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388) ~[?:?] 
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025) ~[?:?] 
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?] 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?] 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:?] 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:?] 
        at java.lang.Thread.run(Thread.java:748) ~[?:?] 
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve br.com.thiagomoreira.application/1.0.0.SNAPSHOT: missing requirement [br.com.thiagomoreira.application/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=osgi.bundle; version="[1.0.0.201808301826,1.0.0.201808301826]"; resolution:=mandatory [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active] 
        at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?] 
        ... 12 more 
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active 
        at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?] 
        at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?] 
        ... 12 more 

Если я разверну комплекты самостоятельно, например, один за другим без файла kar процесс подключения работает хорошо.

Код проекта доступен по адресу https://github.com/tmoreira2020/poc-osgi-whiteboard

Чего мне не хватает?

...