(&(osgi.wiring.package=org.apache.cxf.annotations)(version>=2.7.0)(!(version>=3.0.0)))

This looks like you are building you application bundle with CXF 2.7.x but it’s 
3.0.4 installed in Karaf.   The import range in you bundle is only allowing for 
CXF 2.7.x.

Dan




> On Mar 5, 2015, at 7:27 AM, Martin Nielsen <[email protected]> wrote:
> 
> Hello
> I have a problem that i can't quite figure out. I have created a simple
> osgi bundle that exposes a SOAP service through CXF, but when i try to add
> the @Policy annotation to the SEI i get an error on bundle startup
> indicating that
> org.apache.cxf.annotations is not satisfied as a dependency:
> 
> --------------------------------
> 2015-03-05 12:30:25,455 | ERROR | l for user karaf | ShellUtil
>           | 25 - org.apache.karaf.shell.console - 3.0.3 | Exception caught
> while executing command
> org.apache.karaf.shell.console.MultiException: Error installing bundles:
> Unable to start bundle...
> ...
> Caused by: org.osgi.framework.BundleException: Unresolved constraint in
> bundle time_ws [179]: Unable to resolve 179.0: missing requirement [179.0]
> osgi.wiring.package;
> (&(osgi.wiring.package=org.apache.cxf.annotations)(version>=2.7.0)(!(version>=3.0.0)))
> at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
> at org.apache.karaf.bundle.command.Install.doExecute(Install.java:51)
> ... 17 more
> --------------------------------
> 
> I am running Karaf 3.0.3 and have the cxf feature installed.
> 
> $feature:list
> cxf-specs                       | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-jaxb                          | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-abdera                      | 3.0.4            |           | cxf-3.0.4
>               |
> wss4j                             | 2.0.3            | x         |
> cxf-3.0.4                |
> cxf-core                         | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-wsdl                         | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-ws-policy                  | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-ws-addr                    | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-ws-rm                       | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-ws-mex                    | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-ws-security               | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-rt-security                 | 3.0.4            |           | cxf-3.0.4
>               |
> cxf-http                          | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-http-jetty                   | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-http-async                | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-http-netty-client         | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-http-netty-server        | 3.0.4            |           | cxf-3.0.4
>           |
> cxf-bindings-soap            | 3.0.4            | x         | cxf-3.0.4
>           |
> cxf-jaxws                        | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-jaxrs                         | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-rs-security-xml           | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-rs-security-sso-saml   | 3.0.4            |           | cxf-3.0.4
>         |
> cxf-rs-security-cors          | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-rs-security-oauth        | 3.0.4            |           | cxf-3.0.4
>           |
> cxf-rs-security-jose          | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-rs-security-oauth2       | 3.0.4            |           | cxf-3.0.4
>           |
> cxf-databinding-aegis        | 3.0.4            | x         | cxf-3.0.4
>           |
> cxf-databinding-jibx           | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-databinding-jaxb           | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-databinding-xmlbeans   | 3.0.4            | x         | cxf-3.0.4
>         |
> cxf-features-clustering        | 3.0.4            | x         | cxf-3.0.4
>             |
> cxf-bindings-corba              | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-bindings-coloc              | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-bindings-object             | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-transports-local             | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-transports-jms               | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-transports-udp               | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-transports-websocket-client | 3.0.4            |           | cxf-3.0.4
>               |
> cxf-transports-websocket-server | 3.0.4            |           | cxf-3.0.4
>               |
> cxf-javascript                     | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-frontend-javascript         | 3.0.4            | x         | cxf-3.0.4
>               |
> cxf-xjc-runtime                    | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-tools                             | 3.0.4            |           |
> cxf-3.0.4                |
> cxf                                     | 3.0.4            | x         |
> cxf-3.0.4                |
> cxf-sts                               | 3.0.4            |           |
> cxf-3.0.4                |
> cxf-wsn-api                        | 3.0.4            |           |
> cxf-3.0.4                |
> cxf-wsn                             | 3.0.4            |           |
> cxf-3.0.4                |
> cxf-ws-discovery-api          | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-ws-discovery                | 3.0.4            |           | cxf-3.0.4
>               |
> cxf-bean-validation-core      | 3.0.4            |           | cxf-3.0.4
>             |
> cxf-bean-validation             | 3.0.4            |           | cxf-3.0.4
>               |
> cxf-bean-validation-java6    | 3.0.4            |           | cxf-3.0.4
>           |
> cxf-management-web         | 3.0.4            |           | cxf-3.0.4
>         |
> 
> --------------------------------
> 
> SEI:
> import java.util.Date;
> import java.util.concurrent.TimeUnit;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import org.apache.cxf.annotations.Policy;
> 
> @WebService(name="TimeService")
> @Policy(uri="policy.xml")
> public interface TimeSEI {
> 
>    public Date getCurrentServerTime();
> 
>    public Date addToCurrentServerTime(@WebParam(name="count")long time,
> @WebParam(name="unit")TimeUnit unit);
> 
> }
> 
> --------------------------------
> 
> Service:
> @WebService(endpointInterface="my.package.TimeSEI")
> public class TimeService implements TimeSEI{
> 
>    @Override
>    public Date getCurrentServerTime() {
> return new Date();
>    }
> 
>    @Override
>    public Date addToCurrentServerTime(long time, TimeUnit unit) {
> long timeInMillis = System.currentTimeMillis();
> timeInMillis =+ TimeUnit.MILLISECONDS.convert(time, unit);
> return new Date(timeInMillis);
>    }
> 
> 
> }
> 
> --------------------------------
> blueprint:
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws";
>       xsi:schemaLocation="
>          http://www.osgi.org/xmlns/blueprint/v1.0.0
>          http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
> 
>    <jaxws:endpoint id="ServerTimeService"
>      implementor="my.package.TimeService"
>      address="/timeservice"/>
> 
> </blueprint>
> 
> As i said, the service works just fine, until i have the audacity to add
> the @Policy element.
> 
> I am guessing that i am missing some part of CXF.
> 
> Can someone spot what's wrong?
> 
> And thanks for your help, of cause, and for this wonderful project :)

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to