# Workflow level retry(Java sdk) : io.temporal.failure.ApplicationFailure:

**URL:** <https://community.temporal.io/t/workflow-level-retry-java-sdk-io-temporal-failure-applicationfailure/2225>\
**Category:** Community Support\
**Tags:** retries, workflow-config\
**Created:** [May 25, 2021, 10:19am UTC](https://community.temporal.io/t/workflow-level-retry-java-sdk-io-temporal-failure-applicationfailure/2225 "2021-05-25T10:19:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prakash](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Prakash](https://community.temporal.io/u/Prakash)\
**Post date:** [May 25, 2021, 10:19am UTC](https://community.temporal.io/t/workflow-level-retry-java-sdk-io-temporal-failure-applicationfailure/2225/1 "2021-05-25T10:19:03Z")

</div>

**Q 01)** I’m getting some application failure  
Error : Caused by: io.temporal.failure.ApplicationFailure: message=‘simulated’,  
type=‘java.lang.RuntimeException’, nonRetryable=false

please find out why getting this error

**Q 02)** what is mean by “nonRetryable=false” why it’s getting false  
**Q 03)** pls give some coding example on any exception or error occurred in middle activity level and activity will got failed then again we need to start the workflow level 1st steps onward wants to execute the workflow. (Workflow level retry mechanism)

Please give some example program code in Java sdk

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [May 25, 2021, 3:55pm UTC](https://community.temporal.io/t/workflow-level-retry-java-sdk-io-temporal-failure-applicationfailure/2225/2 "2021-05-25T15:55:15Z")

</div>

> **Q 01)** I’m getting some application failure  
> Error : Caused by: io.temporal.failure.ApplicationFailure: message=‘simulated’,  
> type=‘java.lang.RuntimeException’, nonRetryable=false  
> please find out why getting this error

Either activity or workflow code threw RuntimeException with a “simulated” message. All exceptions that don’t extend [TemporalFailure](https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/failure/TemporalFailure.java) are converted to an [ApplicaitonFailure](https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/failure/ApplicationFailure.java) when crossing activity or workflow boundaries.

> **Q 02)** what is mean by “nonRetryable=false” why it’s getting false

When an unknown exception is converted it is always retryable. You can make it non retryable by:

- Adding its type to the [list of non-retryable failure types](https://github.com/temporalio/sdk-java/blob/ba691a245bfb4fd8450f4c620cbeaff130917076/temporal-sdk/src/main/java/io/temporal/common/RetryOptions.java#L208) in RetryOptions.
- Explicitly creating an ApplicationFailure through ApplicationFailure.[newNonRetryableFailure](https://github.com/temporalio/sdk-java/blob/221c4bb6a197b52e1e242b3713bd61cd251b6190/temporal-sdk/src/main/java/io/temporal/failure/ApplicationFailure.java#L84).

> **Q 03)** pls give some coding example on any exception or error occurred in middle activity level and activity will got failed then again we need to start the workflow level 1st steps onward wants to execute the workflow. (Workflow level retry mechanism)

Retrying the whole workflow on an activity failure is an anti-pattern in the majority of cases. Why do you want to retry the whole workflow instead of retrying the particular activity?
