Hi,

Rather than modify OSGi header of cxf-api bundle, you may need revise felix 
default.properties, likely  add version="1.2" for javax.xml.stream.* package, 
something like
jre-1.6=,\
$B!D(B
javax.xml.stream;version="1.2", \
 javax.xml.stream.events;version="1.2", \
 javax.xml.stream.util;version="1.2", \
$B!D(B 

So that will use both javax.xml.stream.* and javax.xml.transform.* from the 
system bundle 0(JDK), this can remove the "Uses constraint violation" error, 
and that's what Karaf/Servicemix do.

$B!]!]!]!]!]!]!]!]!]!]!]!]!](B
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman$B>.20(B

On 2012-12-26, at $B>e8a(B11:14, Tang Yong wrote:

> Deeply,
> 
> Firstly, "Import-Package" section of cxf-api-2.7.1.jar's MANIFEST.MF
> needs to be modified in order to use javax.xml.stream package from
> org.apache.servicemix.specs.stax-api-1.0-2.1.0.jar rather than system
> package,
> 
> [Before modification]
> Import-Package: ...,javax.xml.stream;version="[0.0,2)",...
> 
> [After modification]
> Import-Package: ...,javax.xml.stream;version="[1.0.1,2)",...
> 
> Secondly, once finishing the above modification and re-launching felix
> 4.0.3, another similar error happened:
> 
> ERROR: Bundle org.apache.cxf.cxf-api [53] Error starting
> file:/E:/gfv4/apachedcxf/distribution/multi-bundle/target/cxf-dosgi-ri-multibundle-distribution-1.4-SNAPSHOT-dir/apache-cxf-dosgi-ri-1.4-SNAPSHOT/dosgi_bundles/cxf-api-2.7.1.jar
> (org.osgi.framework.BundleException: Uses constraint violation. Unable
> to resolve bundle revision org.apache.cxf.cxf-api [53.0] because it is
> exposed to package 'javax.xml.stream' from bundle revisions
> org.apache.servicemix.specs.stax-api-1.0 [22.0] and
> org.apache.felix.framework [0] via two dependency chains.
> 
> Chain 1:
>  org.apache.cxf.cxf-api [53.0]
>    import:
> (&(osgi.wiring.package=javax.xml.stream)(version>=1.0.1)(!(version>=2.0.0)))
>     |
>    export: osgi.wiring.package=javax.xml.stream
>  org.apache.servicemix.specs.stax-api-1.0 [22.0]
> 
> Chain 2:
>  org.apache.cxf.cxf-api [53.0]
>    import: (osgi.wiring.package=javax.xml.transform.stax)
>     |
>    export: osgi.wiring.package=javax.xml.transform.stax;
> uses:=javax.xml.stream
>    export: osgi.wiring.package=javax.xml.stream
>  org.apache.felix.framework [0])
> 
> For such a problem, I made a *temp* confirmation/fixing: modify
> felix.jar/default.properties
> 
> (Because I used jre 1.6)
> [Before modification]
> jre-1.6=, \
> ...
> javax.xml.transform.stax;uses:="javax.xml.stream,javax.xml.transform,javax.xml.stream.events";version="0.0.0.1_006_JavaSE",
> \
> ...
> 
> [After modification]
> jre-1.6=, \
> ...
> javax.xml.transform.stax;version="0.0.0.1_006_JavaSE", \
> ...
> 
> Then, re-launching felix 4.0.3, anything is OK.
> 
> A point to notice is that before felix 4.0.2, in the above
> section(jre-xxx),  javax.xml.transform.stax does not use "uses" clause.
> 
> In addition, I think that we should tell user to add some contents into
> conf/config.properties file of the Felix distribution(from 4.0.2)
> rather than modifying felix.jar/default.properties because this is an
> inner file.
> 
> Please confirm what I said above, thanks.
> 
> --Tang
> 
> Tang Yong wrote:
>> Hi Sergey, Christian
>> 
>> About dcxf multi-bundle distro(my local 1.4 SnapShot) launching, I met a
>> big problem as following,
>> 
>> While launching multi-bundle distro(java -jar bin\felix.jar) using felix
>> 4.0.3, the following exception happened on shell,
>> 
>> ERROR: Bundle org.apache.cxf.cxf-api [53] Error starting
>> file:/E:/gfv4/apachedcxf/distribution/multi-bundle/target/cxf-dosgi-ri-multibundle-distribution-1.4-SNAPSHOT-dir/apache-cxf-dosgi-ri-1.4-SNAPSHOT/dosgi_bundles/cxf-api-2.7.1.jar
>> (org.osgi.framework.BundleException: Uses constraint violation. Unable
>> to resolve bundle revision org.apache.cxf.cxf-api [53.0] because it is
>> exposed to package 'javax.xml.stream' from bundle revisions
>> org.apache.felix.framework [0] and
>> org.apache.servicemix.specs.stax-api-1.0 [22.0] via two dependency chains.
>> 
>> Chain 1:
>>  org.apache.cxf.cxf-api [53.0]
>>    import:
>> (&(osgi.wiring.package=javax.xml.stream)(version>=0.0.0)(!(version>=2.0.0)))
>>     |
>>    export: osgi.wiring.package=javax.xml.stream
>>  org.apache.felix.framework [0]
>> 
>> Chain 2:
>>  org.apache.cxf.cxf-api [53.0]
>>    import: (osgi.wiring.package=com.sun.xml.bind.api)
>>     |
>>    export: osgi.wiring.package=com.sun.xml.bind.api; uses:=javax.xml.stream
>>  org.apache.servicemix.bundles.jaxb-impl [34.0]
>>    import:
>> (&(osgi.wiring.package=javax.xml.stream)(version>=1.0.0)(!(version>=2.0.0)))
>>     |
>>    export: osgi.wiring.package=javax.xml.stream
>>  org.apache.servicemix.specs.stax-api-1.0 [22.0])
>> 
>> $B!Z(BMy Analyse$B![(B
>> I made two confirmations :
>> 
>> 1 there are two bundles which all exported javax.xml.stream,
>> 1) felix.jar
>> using org.osgi.framework.system.packages to export javax.xml.stream and
>> not specifying concrete package version, so defaultly starting from 0.0
>> 
>> 2) org.apache.servicemix.specs.stax-api-1.0-2.1.0.jar
>> explictly exporting javax.xml.stream and specifying package version
>> (version="1.0.1")
>> 
>> 2 cxf-api-2.7.1.jar imports javax.xml.stream;version="[0.0,2)", and 1)
>> and 2) all meet the requirement, so conflict happened.
>> 
>> In addition, cxf-api-2.7.1.jar is added into multi-bundle distro from
>> 1.4, in 1.3 multi-bundle distro, the jar does not exist.
>> 
>> So, please confirm whether having the same problem or not? If yes, I
>> think that the issue should be fixed as soon as possiblie before
>> releasing 1.4.
>> 
>> Thanks
>> --Tang
>> 
> 
> 

Reply via email to