You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ralf Steppacher (JIRA)" <ji...@apache.org> on 2016/01/06 10:24:39 UTC

[jira] [Created] (CAMEL-9483) Deploying bundle with Camel routes packaged in KAR fails randomly

Ralf Steppacher created CAMEL-9483:
--------------------------------------

             Summary: Deploying bundle with Camel routes packaged in KAR fails randomly
                 Key: CAMEL-9483
                 URL: https://issues.apache.org/jira/browse/CAMEL-9483
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.16.1
         Environment: Karaf 4.0.3, blueprint deployment, JDK 1.8_40 on OSX El Capitan and JDK 1.8_65 on Centos 6.5
            Reporter: Ralf Steppacher


I am struggling with random deployment failures of bundles containing Camel routes, packaged in a KAR file. Deployment fails mostly because data formats cannot be found on the classpath or Camel component beans are not found in the registry.

The attached sample KAR file contains one bundle with the following blueprint deployment descriptor:

{code:xml}
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 			xmlns:camel="http://camel.apache.org/schema/blueprint" 			xsi:schemaLocation="				http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
				http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.16.1.xsd">
 
	<bean id="processor" class="ch.rsteppac.karissue.RestProcessor" />

	<camelContext id="rest-api" allowUseOriginalMessage="false" xmlns="http://camel.apache.org/schema/blueprint">
		<restConfiguration component="netty4-http" scheme="http" host="0.0.0.0" port="2016" bindingMode="json">
			<dataFormatProperty key="prettyPrint" value="true" />
		</restConfiguration>

		<rest path="/say/hello" id="poc-route" produces="application/json">
			<get uri="/{yourName}">
				<route>
					<camel:process ref="processor" />
				</route>
			</get>
		</rest>
	</camelContext>
</blueprint>
{code}

The feature file of the KAR:
{code:xml}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="KAR deployment issue PoC">
    <repository>mvn:org.apache.camel.karaf/apache-camel/2.16.1/xml/features</repository>
    <feature name="poc-rest-service" description="Sample REST bundle to demonstrate the deployment issue in Karaf 4" version="0.0.1.SNAPSHOT">
        <details>Sample REST bundle to demonstrate the deployment issue in Karaf 4</details>
        <feature version="2.16.1" prerequisite="false" dependency="false">camel-jackson</feature>
        <feature version="2.16.1" prerequisite="false" dependency="false">camel-blueprint</feature>
        <feature version="2.16.1" prerequisite="false" dependency="false">camel-netty4-http</feature>
        <bundle>mvn:ch.rsteppac.kar-issue/poc-rest-service/0.0.1-SNAPSHOT</bundle>
    </feature>
</features>
{code}

On my development machine (OSX) deploying the sample KAR file succeeds about 8 out of 10 times. It appears that the more features the KAR file contains the lower the probability of success. Our actual project KAR fails deployment about 9 out of 10 times.
Not all Camel components are equally likely to cause the deployment failure. The most likely to trigger a failure are data formats, e.g., jackson-json or jaxb.
Once the KAR file has deployed successfully, restarting Karaf will consistently deploy the bundles successfully. Until one deletes Karaf's data folder, then all bets are off again.

Adding the feature.xml generated for the KAR with {{feature:repo-add}} and then deploying the features with {{feature:install}} virtually never fails.

Stack traces for most frequent deployment failure of the sample KAR are attached to the ticket.



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