Hi

The {{ }} is Camel specific property placeholders.
You cannot use them outside Camel, such as in a JCA resource
definition as you do.

You would have to look at  the Tomcat docs to see how it supports
placeholders in its <Resource> tags.


On Fri, Oct 12, 2012 at 4:30 PM, bebarnes <byron_barn...@homedepot.com> wrote:
> Hello,
>
> I am trying to encrypt a password, store it in a property file, and refer to
> it via a property placeholder in my connection factory JmsComponent.  I am
> using the Jasypt component to do the parsing and decryption.
>
> However, for some reason, camel is interpreting my property placeholders as
> literal values.  I have kept the default prefix/suffix tokens of "{{" and
> "}}" respectively.
>
> In using an SSL connection and a username/password combo on the target
> broker, I get the following error:
>
> /WARNING: Could not refresh JMS Connection for destination 'QUEUE NAME
> REMOVED' - retrying in 5000 ms. Cause: User name [{{mao.user}}] or password
> is invalid./
>
> Here are the steps that I have taken to attempt this functionality:
>
> 1) Setting up jasypt to parse the properties
>
> CamelContext createCamelContext() throws MAOException {
>         logger.info("createCamelContext : start ");
>         CamelContext context = new DefaultCamelContext(createRegistry());
>         context.setLazyLoadTypeConverters(false);
>
>      // create the jasypt properties parser
>         JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
>
>         // and set the master password
>         jasypt.setPassword(key);
>
>         // create the properties component
>         PropertiesComponent pc = new PropertiesComponent();
>
> pc.setLocation("classpath:com/removed/ta/ca/jmf/resource/ApplicationResources.properties");
>
>         // and use the jasypt properties parser so we can decrypt values
>         pc.setPropertiesParser(jasypt);
>
>         // add properties component to camel context
>         context.addComponent("properties", pc);
>
>         return context;
>     }
>
> Here are the contents of that property file:
>
> mao.user=MyUserName
> mao.pass=ENC(actualcontentsremoved)
>
>
>
> 3)  Adding the JNDI queue connection factory to the camelContext:
>
> camelContext.addComponent(maoDefinitions.get(maoId).getConnectionFactoryJNDI(),
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>
> Here is the JNDI entry sitting in a Tomcat context.xml.  I have confirmed
> that it is imported to the camelContext (my messaging operations work fine
> if I hard code the username/password here):
>
> <Resource
>         type="org.apache.activemq.ActiveMQConnectionFactory"
>         name="jms/ActiveMQGridQCF"
>         auth="Container"
>         factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>         description="ActiveMQ QCF for GRID Java Messaging Framework"
>         TRAN="1"
>         brokerURL="ssl://SERVERNAME"
>         userName="{{mao.user}}"
>              password="{{mao.pass}}"
>              useEmbeddedBroker="false"/>
>
>
>
>
> Am I missing something?  I followed the Java DSL tutorial for Jasypt exactly
> but no luck.  Have tried setting the prefix tokens to something else, and
> still the same error.  It seems camel is always interpreting that
> userName="{{mao.user}}" literally and not as a property.
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/JNDI-QCF-camelContext-Parsing-properties-w-Jasypt-tp5720963.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to