Hi,
I am having a problem with a Camel route in Karaf used for JAXB unmarshalling.
The route reads an XML file and searches for specific XML elements "<BKPF>"
with Stax.
When such an XML element is found, JAXB is used for mapping it to a Java object.
With Camel 3.11.0 the route was working. After upgrading to Camel 3.14.1 the
route throws a CamelExecutionException.
The important point is, that this CamelExecutionException *only* occurs, when
the feature camel-cxf is installed as well.
This fact has given me a headache while trying to pinpoint the problem, but the
Exception can be reproduced with Karaf 4.3.2 and 4.3.6.
I tried the following setups, each starting with a completely new vanilla Karaf
and a simple bundle written only for debugging this issue:
Karaf 4.3.2
Setup 1: feature:repo-add camel 3.11.0; feature:install camel-blueprint
camel-quartz => working
Setup 2: feature:repo-add camel 3.11.0; feature:install camel-blueprint
camel-quartz; feature:repo-add cxf 3.4.0; feature:install camel-cxf => working
Setup 3: feature:repo-add camel 3.14.1; feature:install camel-blueprint
camel-quartz => working
Setup 4: feature:repo-add camel 3.14.1; feature:install camel-blueprint
camel-quartz camel-cxf => CamelExecutionException
Karaf 4.3.6
Setup 5: feature:repo-add camel 3.11.0; feature:install camel-blueprint
camel-quartz => working
Setup 6: feature:repo-add camel 3.11.0; feature:install camel-blueprint
camel-quartz; feature:repo-add cxf 3.4.0; feature:install camel-cxf => working
Setup 7: feature:repo-add camel 3.14.1; feature:install camel-blueprint
camel-quartz => working
Setup 8: feature:repo-add camel 3.14.1; feature:install camel-blueprint
camel-quartz camel-cxf => CamelExecutionException
Some additional remarks:
In Setups 2 and 6, some CXF bundles are automatically installed as versions
3.4.0 *and* 4.0.0.SNAPSHOT. I manually removed the 4.0.0.SNAPSHOT bundles
before testing the route.
In Setups 4 and 8, it is not necessary to add a feature repo for CXF, because
it is included in the camel 3.14.1 feature descriptor (for CXF version 3.4.0).
Summing it up:
- When using Camel 3.11.0 it is working with both Karaf 4.3.2 and Karaf 4.3.6 -
the presence of the feature camel-cxf has no influence.
- When using Camel 3.14.1 it is working with both Karaf 4.3.2 and Karaf 4.3.6 -
but only as long as I don't have the feature camel-cxf installed.
- The feature camel-cxf installs bundles for CXF 3.4.0 in all setups (either
because I manually add that specific CXF feature repo or because it is included
in the camel feature descriptor)
I am now at my wits' end and don't know, how to proceed/debug further. I need
camel-cxf for other bundles that will be deployed in the same karaf instance.
The CamelExecutionException occurs in my bundle when unmarshalling the XML
element BKPF from xmlEventReader:
if(xmlEventReader.peek().isStartElement()
&&
xmlEventReader.peek().asStartElement().getName().getLocalPart().equals("BKPF"))
{
BKPF bkpf = (BKPF) unmarshaller.unmarshal(xmlEventReader);
...
The CamelExecutionException does not seem to give any helpful information. It
seems to be caused by a java.lang.NoSuchMethodError.
When setting logging to trace, this is what I see:
2022-02-18T09:42:53,451 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
BeanInfo | 63 - org.apache.camel.camel-bean - 3.14.1 |
Chosen method to invoke: public void de.janschulze.jaxbtest.TestBean.test()
throws java.lang.Exception on bean: de.janschulze.jaxbtest.TestBean@5b23a865
2022-02-18T09:42:53,451 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
MethodInfo | 63 - org.apache.camel.camel-bean - 3.14.1 |
>>>> invoking: public void de.janschulze.jaxbtest.TestBean.test() throws
java.lang.Exception on bean: de.janschulze.jaxbtest.TestBean@5b23a865 with
arguments: null for exchange: Exchange[F6AF588CBDB8D3D-0000000000000002]
2022-02-18T09:42:53,451 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
BundleDelegatingClassLoader | 110 - org.apache.camel.karaf.camel-core-osgi
- 3.14.1 | FindResource: META-INF/services/javax.xml.bind.JAXBContextFactory
2022-02-18T09:42:53,459 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
RedeliveryErrorHandler | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Is exchangeId: F6AF588CBDB8D3D-0000000000000002 done? false
2022-02-18T09:42:53,460 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultReactiveExecutor | 62 - org.apache.camel.camel-base-engine -
3.14.1 | Schedule [first=false, main=false, sync=false]: RedeliveryTask
2022-02-18T09:42:53,460 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultReactiveExecutor | 62 - org.apache.camel.camel-base-engine -
3.14.1 | Queuing reactive work: RedeliveryTask
2022-02-18T09:42:53,460 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultReactiveExecutor | 62 - org.apache.camel.camel-base-engine -
3.14.1 | Worker #3 running: RedeliveryTask
2022-02-18T09:42:53,460 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Finding best suited exception policy for thrown exception
java.lang.NoSuchMethodError
2022-02-18T09:42:53,461 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Finding best suited exception policy for thrown exception
org.apache.camel.CamelExecutionException
2022-02-18T09:42:53,461 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Finding best suited exception policy for thrown exception
java.lang.NoSuchMethodError
2022-02-18T09:42:53,461 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Finding best suited exception policy for thrown exception
org.apache.camel.CamelExecutionException
2022-02-18T09:42:53,462 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Adding ExceptionPolicyKey[route: <global>, class
org.apache.camel.CamelExecutionException] as candidate at level 0
2022-02-18T09:42:53,462 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Exact match found for candidate: ExceptionPolicyKey[route: <global>,
class org.apache.camel.CamelExecutionException]
2022-02-18T09:42:53,462 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultExceptionPolicyStrategy | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Found 1 candidates
2022-02-18T09:42:53,462 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
CoreTypeConverterRegistry | 61 - org.apache.camel.camel-base - 3.14.1 |
Finding type converter to convert java.lang.String -> java.lang.Integer with
value: 0
2022-02-18T09:42:53,462 | TRACE | Camel (jaxbtest) thread #4 - timer://jaxb |
CoreTypeConverterRegistry | 61 - org.apache.camel.camel-base - 3.14.1 |
Using bulk converter: CamelBaseBulkConverterLoader to convert [class
java.lang.String=>class java.lang.Integer]
2022-02-18T09:42:53,463 | DEBUG | Camel (jaxbtest) thread #4 - timer://jaxb |
DefaultErrorHandler | 72 - org.apache.camel.camel-core-processor -
3.14.1 | Failed delivery for (MessageId: F6AF588CBDB8D3D-0000000000000002 on
ExchangeId: F6AF588CBDB8D3D-0000000000000002). On delivery attempt: 0 caught:
org.apache.camel.CamelExecutionException: Exception occurred during execution
on the exchange: Exchange[F6AF588CBDB8D3D-0000000000000002]
Can anyone help with some suggestions?
Kind Regards
--
Jan Schulze