Menu

#17 EncryptablePropertyPlaceholder cannot be initialized

v1.9.x
open
5
2014-08-21
2012-04-08
No

(from http://forum.jasypt.org/Jasypt-Spring3-configuration-errors-on-startup-td5539288.html )

<<

<bean id="mainPropertyConfigurer" class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg>
<bean class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="password" value="xxx"/>
</bean>
</constructor-arg>
<property name="order" value="3"/>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="ignoreResourceNotFound" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="locations">
<list>
<value>classpath:application.properties</value>
</list>
</property>
</bean>
TRACE 2012-03-05 15:24:03,946 ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.beans.factory.support.DefaultListableBeanFactory - Ignoring constructor [public org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer(org.jasypt.util.text.TextEncryptor)] of bean 'mainPropertyConfigurer': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainPropertyConfigurer' defined in class path resource [edu/capella/learningdelivery/pif/portal/web/spring/spring-main.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.IllegalArgumentException: 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

<bean id="mainPropertyEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="password" value="xxx"/>
</bean>

<bean id="mainPropertyConfigurer" class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="mainPropertyEncryptor"/>
<property name="order" value="3"/>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="ignoreResourceNotFound" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="locations">
<list>
<value>classpath:application.properties</value>
</list>
</property>
</bean>
TRACE 2012-03-05 15:53:52,291 ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.beans.factory.support.DefaultListableBeanFactory - Ignoring constructor [public org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer(org.jasypt.util.text.TextEncryptor)] of bean 'mainPropertyConfigurer': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainPropertyConfigurer' defined in class path resource [edu/capella/learningdelivery/pif/portal/web/spring/spring-main.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.IllegalArgumentException: 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

<bean id="mainPropertyEncryptor" class="org.jasypt.util.text.BasicTextEncryptor">
<property name="password" value="xxx"/>
</bean>

<bean id="mainPropertyConfigurer" class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="mainPropertyEncryptor"/>
<property name="order" value="3"/>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="ignoreResourceNotFound" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="locations">
<list>
<value>classpath:application.properties</value>
</list>
</property>
</bean>
TRACE 2012-03-05 16:19:30,736 ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.beans.factory.support.DefaultListableBeanFactory - Ignoring constructor [public org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer(org.jasypt.encryption.StringEncryptor)] of bean 'mainPropertyConfigurer': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainPropertyConfigurer' defined in class path resource [edu/capella/learningdelivery/pif/portal/web/spring/spring-main.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.util.text.BasicTextEncryptor] to required type [org.jasypt.encryption.StringEncryptor]: Failed to convert value of type [org.jasypt.util.text.BasicTextEncryptor] to required type [org.jasypt.encryption.StringEncryptor]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.jasypt.util.text.BasicTextEncryptor] to required type [org.jasypt.encryption.StringEncryptor]: no matching editors or conversion strategy found

>>

Discussion

  • Steve

    Steve - 2013-12-16

    Having the exact same problem. I cannot recreate the problem locally (in Eclipse/JBoss) but it is in our test and prod environments.

     
  • Steve

    Steve - 2013-12-19

    I found that in the properties file that contained the text to be decrypted (where the ENC(....) was located) the property on the next line was not actually on the next line but was concatenated to the end of the previous line (i.e. no newline for the ENC(...) line). This caused the decryption to fail (for obvious reasons).

     

Log in to post a comment.