Uploaded image for project: 'SwitchYard'
  1. SwitchYard
  2. SWITCHYARD-2132

Cannot inject an environment variable into Rules and BPMN implementations

    Details

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Two possible workarounds:

      1. Declare a domain/composite/component property with its value set to ${env.myEnvProperty}. Then use the property in the from attribute of inputs/global.

      2. Use System.getenv("myEnvProperty} in Script Task in BPMN or in Rules. This can however cause following exception if security manager is turned on

      org.switchyard.HandlerException: Exception executing consequence for rule "BasicPropertyServiceRules" in org.jboss.soa.qa.property: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getenv.myEnvProperty")
      
      Show
      Two possible workarounds: 1. Declare a domain/composite/component property with its value set to ${env.myEnvProperty}. Then use the property in the from attribute of inputs/global. 2. Use System.getenv("myEnvProperty} in Script Task in BPMN or in Rules. This can however cause following exception if security manager is turned on org.switchyard.HandlerException: Exception executing consequence for rule "BasicPropertyServiceRules" in org.jboss.soa.qa.property: java.security.AccessControlException: access denied ( "java.lang.RuntimePermission" "getenv.myEnvProperty" )

      Description

      An environment variable cannot be injected into Rules and BPMN implementations. Environment variables are referenced with an "env." prefix. The dot in the prefix causes the problem. MVEL is used for resolution of an expression in the from attribute of:

      <rules:global from="env.myEnvProperty" to="myEnvProperty"/>
      

      However, MVEL interprets the expression as "invoke the myEnvProperty on the object env. And following expression is thrown:

      org.switchyard.HandlerException: [Error: null pointer: env.basicEnvironment]
      

      As far as I know, MVEL does not support escaping of a dot. I have already discussed this limitation with David Ward. The purpose of this JIRA is to document the limitation. It could be also mentioned in the docs. Workarounds exist, so setting minor priority.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tcunning Thomas Cunningham
                Reporter:
                trohovsky Tomas Rohovsky
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: