How to use the camel component properties outside camel context ?

Solution Verified - Updated -

Issue

  • We have 2 questions about using JASYPT for property file value encryption in Camel using Blueprint in Fuse 6.1. The first question is about which direction we should take when implementing this, and the second is errors we are getting using both options.

  • So if we understand this correctly, I have 2 options:

    • I can use org.apache.camel.component.jasypt.JasyptPropertiesParser with org.apache.camel.component.properties.PropertiesComponent all wrapped up under the camel-jasypt (2.12.0) dependency. See the snippet below:
  <bean id="configProperties" class="org.apache.camel.component.properties.PropertiesComponent">

    <property name="location" value="classpath:activeMQ.properties"/>

    <property name="propertiesParser" ref="jasypt"/>

  </bean>

  <cxf:cxfEndpoint id="reportEndpoint"

                   address="/report/"

                   serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"

                   wsdlURL="wsdl/report_incident.wsdl"/>



  <broker:broker persistent="true" brokerName="amqBroker">

    <broker:transportConnectors>

      <broker:transportConnector uri="tcp://${activeMQ.url}"/>

    </broker:transportConnectors>

  </broker:broker>

  • We can use property-placeholder from blueprint-ext and property-placeholder from jasypt all wrapped up under the org.jasypt (1.9.2) dependency. It uses org.jasypt.encryption.pbe.StandardPBEStringEncryptor.

  • The first problem we have with #1 is it doesn't seem to allow us to use ${xxxxx} outside of the camel context. We tried using an unencrypted ActiveMQ URL in the properties file, but when we tried using it to configure the connection outside of the context using ${activeMQ.url}, it wasn't replaced. When we used {{activeMQ.queueName}} inside the context, it worked great.

  • The problem we have with #2 is a ClassNotFoundException on org.jasypt.encryption.pbe.StandardPBEStringEncryptor. We have this dependency in the pom.xml

    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>1.9.2</version>
    </dependency>
  • But we don't see the JAR Fuse would need to resolve that class. What are we missing here ? Also, in terms of the problem we are having with option #1, can I we use ${xxx} syntax outside of the context for encrypted property values?

Environment

  • Red Hat JBoss Fuse
    • 6.x
  • camel-jasypt component

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content