karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jirka (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-4730) Feature not installed - missing requirement osgi.service; effective:=active; filter
Date Sun, 09 Oct 2016 11:26:20 GMT

    [ https://issues.apache.org/jira/browse/KARAF-4730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15559833#comment-15559833
] 

Jirka commented on KARAF-4730:
------------------------------

The cause is that Karaf + Felix cannot handle well when a bundle depends on a service with
filter. The dependency can be declared in these bundle manifest header fields:

{code}
Import-Service
Require-Capability
{code}

Import-Service is deprecated by the OSGI specification. The Felix maven bundle plugin still
puts it inside the bundle manifest but it can be filtered out by adding the following configuration
inside the Felix maven bundle plugin:

{code}
<configuration>
	<instructions>
		<_removeheaders>Import-Service,Export-Service</_removeheaders>
	</instructions>
</configuration>
{code}

Require-Capability can contain service dependency for bundle with JPA persistence.xml that
contains:
{code}
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=myDB)</jta-data-source>
{code}

The Felix maven bundle plugin propagates it into the bundle manifest Require-Capability:

{code}
osgi.service; objectClass=javax.sql.DataSource; effective:=active; filter:="(osgi.jndi.service.name=myDB)"
{code}

A workaround is to use older Felix maven bundle plugin. For example version 3.0.1 does not
propagate this required capability into the bundle manifest. On the other hand version 3.2.0
does propagate it.


> Feature not installed -  missing requirement osgi.service; effective:=active; filter
> ------------------------------------------------------------------------------------
>
>                 Key: KARAF-4730
>                 URL: https://issues.apache.org/jira/browse/KARAF-4730
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.0.6
>            Reporter: Jirka
>
> I have a feature that works correctly on Karaf 4.0.5. When I try to install it on Karaf
4.0.6, I get an error.
> {code}
> 2016-09-24 16:03:56,955 | ERROR | nsole user karaf | ShellUtil                      
 | 43 - org.apache.karaf.shell.core - 4.0.6 | Exception caught while executing command
> org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement
[root] osgi.identity; osgi.identity=myapp; type=karaf.feature; version="[1.4.0.SNAPSHOT,1.4.0.SNAPSHOT
> ]"; filter:="(&(osgi.identity=myapp)(type=karaf.feature)(version>=1.4.0.SNAPSHOT)(version<=1.4.0.SNAPSHOT))"
[caused by: Unable to resolve myapp/1.4.0.SNAPSHOT: missing requirement [myapp/1
> .4.0.SNAPSHOT] osgi.identity; osgi.identity=com.myapp.mybundle; type=osgi.bundle; version="[1.4.0.SNAPSHOT,1.4.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve com.myapp.mybundle/1.4.0.SNAPSHOT: missing
requirement [com.myapp.mybundle/1.4.0.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.n
> ame=myDB))"]]
>         at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:235)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[8:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[8:org.apache.karaf.features.core:4.0.6]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_92]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_92]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_92]
>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_92]
> {code} 
> The feature has a bundle com.myapp.mybundle with a blueprint file with a reference to
a service registered earlier.
>  
> {code}
> 	<reference id="dataSourceRef" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=myDB)"
/>
> {code}
> The service is registered correctly with the required interface and property.
> When I install the bundle manually from the Karaf shell, it installs correctly.
> When I remove the filter from the blueprint reference, 
> <reference id="dataSourceRef" interface="javax.sql.DataSource" 
> -filter="(osgi.jndi.service.name=myDB)"- />
> both the feature and the bundle install correctly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message