You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Wessel Nieboer (JIRA)" <ji...@apache.org> on 2014/12/10 17:53:13 UTC

[jira] [Commented] (CAMEL-7849) Encrypted properties inside and outside

    [ https://issues.apache.org/jira/browse/CAMEL-7849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14241371#comment-14241371 ] 

Wessel Nieboer commented on CAMEL-7849:
---------------------------------------

Did you also run this Camel route inside an osgi container? I'm trying to run it in JBoss Fuse 6.1.0 but am getting the following error:

Error creating bean with name 'propertyConfigurer' defined in URL [bundle://325.0:0/META-INF/spring/camel-context-dev.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.jasypt.encryption.StringEncryptor]: Could not convert constructor argument value of type [org.jasypt.encryption.pbe.StandardPBEStringEncryptor] to required type [org.jasypt.encryption.StringEncryptor]: Failed to convert value of type 'org.jasypt.encryption.pbe.StandardPBEStringEncryptor' to required type 'org.jasypt.encryption.StringEncryptor'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.jasypt.encryption.pbe.StandardPBEStringEncryptor] to required type [org.jasypt.encryption.StringEncryptor]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'propertyConfigurer' defined in URL [bundle://325.0:0/META-INF/spring/camel-context-dev.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.jasypt.util.text.TextEncryptor]: Could not convert constructor argument value of type [org.jasypt.encryption.pbe.StandardPBEStringEncryptor] to required type [org.jasypt.util.text.TextEncryptor]: Failed to convert value of type 'org.jasypt.encryption.pbe.StandardPBEStringEncryptor' to required type 'org.jasypt.util.text.TextEncryptor'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.jasypt.encryption.pbe.StandardPBEStringEncryptor] to required type [org.jasypt.util.text.TextEncryptor]: no matching editors or conversion strategy found


If so, do you know how to fix this?

Works fine when running mvn camel:run from the commandline. Using Camel version 2.12.0-redhat and jasypt-spring31 version 1.9.2

> Encrypted properties inside and outside <camelContext>
> ------------------------------------------------------
>
>                 Key: CAMEL-7849
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7849
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.13.2, 2.14.0
>            Reporter: Camel Guy
>            Assignee: Willem Jiang
>            Priority: Minor
>
> {noformat}
> File default.properties contains an entry like: key=ENC(..)
> The following Camel Spring DSL snippet decrypts the 
> property value inside <camelContext> via {{key}} but does 
> not decrypt it outside of the <camelContext> via ${key}:
> <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
>     <property name="password" value="sysenv:PROPERTIES_KEY"/>
> </bean>
> <bean id="bridgePropertyPlaceholder" class=
>   "org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>   <property name="locations" >
>   <list>
>     <value>classpath:default.properties</value>
>   </list></property>
>   <property name='parser' ref='jasypt'/>
> </bean>
> In order to get ${} to decrypt, first I remove all of the above. 
> Then I add jasypt dependencies to pom.xml:
> <dependency>
>   <groupId>org.jasypt</groupId>
>   <artifactId>jasypt</artifactId>
>   <classifier>lite</classifier>
>   <version>1.9.2</version>
> </dependency>
>  <dependency>
>   <groupId>org.jasypt</groupId>
>   <artifactId>jasypt-spring3</artifactId>
>   <version>1.9.2</version>
>  </dependency> 
> And add the following to Camel Spring DSL:
> <bean id="environmentVariablesConfiguration"
>      class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
>    <property name="algorithm" value="PBEWithMD5AndDES" />
>    <property name="passwordEnvName" value="PROPERTIES_KEY" />
>  </bean>
>  <bean id="configurationEncryptor"
>      class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
>    <property name="config" ref="environmentVariablesConfiguration" />
> </bean>
> <bean id="propertyConfigurer" class=
>   'org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer'>
>  <constructor-arg ref="configurationEncryptor"/>
>    <property name="locations" >
>   <list>
>     <value>classpath:default.properties</value>
>   </list></property>
> </bean>
> <bean id="jasypt" class=
>   "org.apache.camel.component.jasypt.JasyptPropertiesParser">
>     <property name="password" value="sysenv:PROPERTIES_KEY"/>
> </bean>
> <!-- And inside the camelContext... -->
> <camelContext xmlns="http://camel.apache.org/schema/spring">
> <propertyPlaceholder id="properties"
>  propertiesParserRef="jasypt" 
>  location="classpath:default.properties"/> 
> This is the only solution that I could discover. Using BridgePropertyPlaceholder 
> didn't work. <propertyPlaceholder> must be used inside <camelContext>.
> {noformat}



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