Hi Everyone,

in my project, (converting routes from camel 2.17 to camel 3.xx) i will be 
facing a problem with CXF.

The tests were carried out with Karaf (V 4.2.x,4.3.x), camel (V 3.11.x, 3.12) 
and CXF (V 3.4.x)
Karaf run on openjdk version "1.8.0_282"
featuresBoot = \
    (instance/4.3.3, package/4.3.3, log/4.3.3, ssh/4.3.3, framework/4.3.3, 
system/4.3.3, eventadmin/4.3.3, feature/4.3.3, shell/4.3.3, management/4.3.3, \
    service/4.3.3, jaas/4.3.3, deployer/4.3.3, diagnostic/4.3.3, wrap/2.6.7, 
bundle/4.3.3, config/4.3.3, kar/4.3.3, webconsole/4.2.12, jms/4.2.12, 
pax-jms-config/1.1
.0, pax-jms-artemis/1.1.0, jaxb ) , \
(camel/3.12, camel-barcode, camel-base64, camel-beanio, camel-csv, 
camel-crypto, camel-dns, camel-fop, camel-ftp, camel-groovy, camel-gson, 
camel-http, camel-jetty,
camel-jms, camel-jackson, camel-jacksonxml, camel-ldap, camel-mail, 
camel-openapi-java, camel-soap, camel-sql, camel-saxon, camel-servlet, 
camel-tagsoup, camel-xj, c
amel-xstream, camel-xslt-saxon, camel-zipfile, camel-cxf)  , \
cxf/3.4.5, artemis/2.17

** Here is the symptom **
At initial deployment (8 times out of 10), when I deploy and start a 
camel-route using cxf bean, it works.
If later I destroy and redeploy this route it still works
Stop karaf OSGI
Start again karaf OSGI
Start the same camel-route using the same cxf bean, it always fails with 
noSuchMethodError:
ava.lang.NoSuchMethodError: 
org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;

** Here is what I did to get around this problem **
So i check where is deployed this class: org.codehaus.stax2.ri.EmptyIterator

bundle:find-class org.codehaus.stax2.ri.EmptyIterator

Jackson-dataformat-XML (96)
org/codehaus/stax2/ri/EmptyIterator.class

Woodstox (103)
org/codehaus/stax2/ri/EmptyIterator.class

Stax2 API (347)
org/codehaus/stax2/ri/EmptyIterator.class

Stax2 API (348)
org/codehaus/stax2/ri/EmptyIterator.class

Woodstox XML-processor (349)
org/codehaus/stax2/ri/EmptyIterator.class


???? 2 Stax2 API version ?????? 
(Bundle 347) 
Bundle-Version = 3.1.4

(Bundle 348)
Bundle-Version = 4.2.1

Then i found that the bundle (349) need Stax2-API version 3.1.4, so i decide to 
make some modification in this file

org/apache/camel/karaf/apache-camel/3.12.0/apache-camel-3.12.0-features.xml
  <feature name='xml-specs-api' version='2.9.0' start-level='10'>
    <bundle 
dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0</bundle>
    <bundle 
dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.0/2.9.0</bundle>
    <bundle 
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.2/2.9.0</bundle>
    <bundle 
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.0</bundle>
    <bundle 
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.3/2.3_2</bundle>
   <!--  D.Langevin 2021.10.18 Conflict with Apache cxf 3.4.x -->
   <!--  <bundle>mvn:org.codehaus.woodstox/stax2-api/3.1.4</bundle> -->
   <!--  <bundle>mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1</bundle> -->
    
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-runtime/2.3.1_1</bundle>
  </feature>

Many feature of CAMEL use org.codehaus.woodstox/stax2-api/4.2, 
Many feature of CXF   use org.codehaus.woodstox/stax2-api/4.2.1
i deciced to leave it, because i dont noticed problem at this time !!!!! 


Then i redo my test, and it's works...  all the time,  
Initial deployment (10/10)
Stop and start karaf (10/10)
Modification of camel-route using cxf bean (10/10)


Hope this can help you while waiting for a fix

Daniel Langevin
Societe d'habitation du Quebec
Quebec City

Reply via email to