You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Jean-Baptiste Onofré (Jira)" <ji...@apache.org> on 2021/04/01 08:23:00 UTC

[jira] [Updated] (AMQ-8067) ERROR EncryptablePropertyPlaceholderConfigurer

     [ https://issues.apache.org/jira/browse/AMQ-8067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated AMQ-8067:
--------------------------------------
    Fix Version/s:     (was: 5.16.2)
                       (was: 5.15.15)
                       (was: 5.17.0)

>  ERROR EncryptablePropertyPlaceholderConfigurer
> -----------------------------------------------
>
>                 Key: AMQ-8067
>                 URL: https://issues.apache.org/jira/browse/AMQ-8067
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Camel, JDBC
>    Affects Versions: 5.16.0
>            Reporter: Glaucia Lauton
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>              Labels: RedHat
>
> I need to upload the ActiveMQ broker with the encrypted database password in the settings file. Following the documentation's guidelines (http://activemq.apache.org/encrypted-passwords.html), I inserted the encrypted password in the credential-enc.properties file:
> activemq.username=system
> activemq.password=ENC(PPgVUnUbOcppkgArDhYZxw==)
> guest.password=ENC(fDPBo/lP5M/Kqb0WY3/ZC4PDXMmUq10O)
> jdbc.password=ENC(lPDQrWH6zV9SQ2FDvzAksYVyfU6Trx/c)
> Then, I edited the activemq-security.xml file:
> The encryption-related properties of the activemq-security.xml file have not been changed:
> <!-- Allows us to use encrypted system properties as variables in this configuration file -->
>  <bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
>  <property name="algorithm" value="PBEWithMD5AndDES" />
>  <property name="passwordEnvName" value="ACTIVEMQ_ENCRYPTION_PASSWORD" />
>  </bean>
>  
>  <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
>  <property name="config" ref="environmentVariablesConfiguration" />
>  </bean> 
>  
>  <bean id="propertyConfigurer" class="org.jasypt.spring4.properties.EncryptablePropertyPlaceholderConfigurer">
>  <constructor-arg ref="configurationEncryptor" /> 
>  <property name="location" value="file:${activemq.conf}/credentials-enc.properties"/> 
>  </bean>
> I added the transport connectors:
> <transportConnectors>
>  <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=103857600"/>
>  <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=103857600"/>
>  <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=103857600"/>
>  <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=103857600"/>
>  <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=103857600"/>
>  </transportConnectors>
> My connection to the database and the queues is as follows:
> <bean id="requiredBeanForOracleAq" class="org.apache.activemq.ActiveMQConnectionFactory"/>
>  <bean id="connectionFactoryOracleAQQueue" class="oracle.jms.AQjmsFactory" factory-method="getQueueConnectionFactory">
>  <constructor-arg index="0">
>  <value>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MYSID)))</value>
>  </constructor-arg>
>  <constructor-arg index="1" type="java.util.Properties">
>  <value></value>
>  </constructor-arg>
>  </bean>
> <bean id="oracleQueueCredentials" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>  <property name="targetConnectionFactory">
>  <ref bean="connectionFactoryOracleAQQueue"></ref>
>  </property>
>  <property name="username">
>  <value>MYUSER</value>
>  </property>
>  <property name="password">
>  <value>${jdbc.password}</value>
>  </property>
>  </bean>
> <bean id="oracleQueue" class="org.apache.camel.component.jms.JmsComponent">
>  <property name="connectionFactory" ref="oracleQueueCredentials"/>
>  </bean>
> I exported the ACTIVEMQ_ENCRYPTION_PASSWORD environment variable with the name of my encryption, but when trying to upload activemq I am facing the following error:
> ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.NullPointerException
> java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.NullPointerException
>  at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:91)
>  at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
>  at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
>  at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
>  at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498)
>  at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
>  at org.apache.activemq.console.Main.main(Main.java:115)
> Caused by: java.lang.NullPointerException
>  at org.jasypt.encryption.pbe.config.SimplePBEConfig.getPasswordCharArray(SimplePBEConfig.java:487)
>  at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.resolveConfigurationPassword(StandardPBEByteEncryptor.java:842)
>  at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:643)
>  at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:566)
>  at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:718)
>  at org.jasypt.properties.PropertyValueEncryptionUtils.decrypt(PropertyValueEncryptionUtils.java:72)
>  at org.jasypt.spring4.properties.EncryptablePropertyPlaceholderConfigurer.convertPropertyValue(EncryptablePropertyPlaceholderConfigurer.java:108)
>  at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperty(PropertyResourceConfigurer.java:123)
>  at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperties(PropertyResourceConfigurer.java:106)
>  at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:83)
>  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)
>  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:163)
>  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
>  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
>  at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
>  at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
>  at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)
>  at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
>  at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
>  at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
>  at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
>  at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
>  ... 10 more
> I noticed that the class cited in the cryptographic properties (<bean id = "propertyConfigurer" class = "org.jasypt.spring4.properties.EncryptablePropertyPlaceholderConfigurer" />) was trying to query a URL that was not being referenced in the schemaLocation. I added the URL http://www.jasypt.org/schema/encryption/jasypt-spring4-encryption-1.xsd to the schemaLocation and saved the file.
> xmlns="http://www.springframework.org/schema/beans"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.jasypt.org/schema/encryption/jasypt-spring4-encryption-1.xsd" >
> The error still persists.
> I also tried to use the connection to the MySQL database, identical to the one in the documentation:
> <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>  <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>  <property name="url" value="jdbc:mysql://localhost:3306/MYSQLBCF"/>
>  <property name="username" value="activemq"/>
>  <property name="password" value="${jdbc.password}"/>
>  <property name="maxActive" value="200"/>
>  <property name="poolPreparedStatements" value="true"/>
>  </bean>
> I made sure to export the ACTIVEMQ_ENCRYPTION_PASSWORD variable with the name of my encryption, but the error remains at the same point.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)