Unknown property used in expression: #{getStats}

Hello,
I partially followed the java EE 7 tutorial, I created a maven project with a process that executes a service task (Delegate Expression - #{getStats})

Then I created a simple java delegate

@Named("getStats")
public class GetStatsDelegate implements JavaDelegate {

  private final Logger LOGGER = LoggerFactory.getLogger(GetStatsDelegate.class.getName());

  public void execute(DelegateExecution execution) throws Exception {

    LOGGER.info("Get Stats.........");
  }
}

I wrote a unit test in which the service gets called correctly.

then I deploy the war to wildfly and when I try to start the process I get the error in the title. (The process is quite simple at this stage, with only the service task)

I also checked the war and the the delegate is included.
Any ideas?
Thanks!
Thanks

Hi @Anna_Setiva,

The delegate expression is used to dynamically resolve the Java class name that is used as a delegate class. After all it is an expression that the engine tries to resolve. In your case it tries to access a property called “getStats”. This property is not there so the process fails with the “unknown property” error.

For your use-case it seems that the delegate will be the same every time. In that case try to use the Java Class implementation for your Service Task.

grafik

If you want to make it dynamic and decide which delegate to call, pass a variable called “getStats” with the name of the delegation class as value when starting the process instance.

If you want to learn more about delegates, go to our documentation

Best,
Miklas

1 Like