0

I'm working with Apache Camel and JBoss Fuse 6.3 on JBoss EAP 6.4. I'd like to access environment properties via Spring DSL (like for example the JBoss Fuse home location) but I'm getting an error: with the following code

<camel:setProperty id="_setProperty1" propertyName="provaProp">
   <camel:simple>${env:JBOSS_FUSE_HOME}</camel:simple>
</camel:setProperty>

I'm getting this error

Caused by: org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Unknown function: env:JBOSS_FUSE_HOME at location 0

Changing JBOSS_FUSE_HOME in JBOSS_EAP home doens't solve

<camel:setProperty id="_setProperty1" propertyName="provaProp">
   <camel:simple>${env:JBOSS_EAP_HOME}</camel:simple>
</camel:setProperty>

Caused by: org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Unknown function: env:JBOSS_EAP_HOME at location 0

What is the problem?

GSX
  • 63
  • 7

2 Answers2

1

I must admit I'm answering from the top of my head, have you tried with:

<camel:setProperty id="_setProperty1" propertyName="provaProp">
   <camel:simple>{{env:JBOSS_FUSE_HOME}}</camel:simple>
</camel:setProperty>
Valdar
  • 76
  • 4
1

The simple language function for ENV variables was unfortunately created as sysenv.XXX style, so use

<camel:simple>${sysenv.JBOSS_FUSE_HOME}</camel:simple>

http://camel.apache.org/simple

The property placeholders, on the other hand (not the same as simple), supports env, which you can do via {{env:xxx}} style:

<camel:simple>{{env:JBOSS_FUSE_HOME}}</camel:simple>

And since it can be looked up just once, you can use a constant if you will:

<camel:constant>{{env:JBOSS_FUSE_HOME}}</camel:constant>

http://camel.apache.org/using-propertyplaceholder.html

Valdar
  • 76
  • 4
Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65