[ 
https://issues.apache.org/jira/browse/IGNITE-28073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ashish Mishra updated IGNITE-28073:
-----------------------------------
    Summary: Examples fail with IllegalStateException when run directly - 
deploymentUnitJar not built + examples not self-contained  (was: Examples fail 
with IllegalStateException when run directly — deploymentUnitJar not built)

> Examples fail with IllegalStateException when run directly - 
> deploymentUnitJar not built + examples not self-contained
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-28073
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28073
>             Project: Ignite
>          Issue Type: Bug
>          Components: examples ai3
>            Reporter: Ashish Mishra
>            Assignee: Ashish Mishra
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> *Issue 1: deploymentUnitJar not wired into direct Gradle JavaExec execution*
> Running any example that requires a deployment unit directly via Gradle fails 
> with:
> {color:#FF0000}  *java.lang.IllegalStateException: Deployment unit JAR not 
> found at: 
> .../examples/java/build/libs/deploymentunit-example-1.0.0.jar*{color}
>   Please build the project first: ./gradlew :ignite-examples:build
>   *Affected examples :*
>   - code/deployment/CodeDeploymentExample
>   - compute/ComputeAsyncExample
>   - compute/ComputeBroadcastExample
>   - compute/ComputeCancellationExample
>   - compute/ComputeColocatedExample
>   - compute/ComputeExample
>   - compute/ComputeJobPriorityExample
>   - compute/ComputeJobStateExample
>   - compute/ComputeMapReduceExample
>   - compute/ComputeWithCustomResultMarshallerExample
>   - compute/ComputeWithResultExample
>   - serialization/SerializationExample
>   - streaming/DistributedComputeWithReceiverExample
>   - streaming/MultiTableDataStreamerExample
>   *Root cause:* deploymentUnitJar was only wired into the build lifecycle. 
> Direct class execution via Gradle uses a JavaExec task that only depends on 
> classes, bypassing deploymentUnitJar.
> *Issue 2: Missing or broken setup/teardown in several examples*
> For an example to be self-contained, it must create all resources it needs 
> (tables, deployment units, caches, etc.) during setup, and destroy them once 
> execution completes. Several examples are not doing this — teardown is either 
> missing or not executing correctly, leaving behind residual state.
> This causes:
> Failures when examples are re-run on the same cluster without a reset
> State leakage between examples when run sequentially in ai3tests
> Unreliable cyclic stability testing
> *Background / Motivation:*
> The ai3tests framework imports the ignite-examples JAR and drives each 
> example class as an automated test, invoking them via a shared 
> runExample(...) utility:
> java@Test
> @DisplayName("Run ComputeRustJobExample")
> public void testCompute*Example() {
>     runExample(Compute*Example.class);
> }
> This pattern allows individual examples to be validated in a repeatable, 
> CI-friendly way and forms the foundation for cyclic stability testing as 
> well. For this to work reliably, examples must be executable directly via 
> Gradle without requiring a manual build step beforehand — making this fix a 
> prerequisite for stable automated test execution.
>   *Steps to reproduce:*
>   *1.* Clone the repo without any prior build artifacts
>   *2.* Start a local 3-node Ignite cluster (just setup_cluster)
>   *3.* Run any affected example directly, e.g.:
>   _./gradlew :ignite-examples:ComputeJobPriorityExample.main()_
>   *4.* Observe IllegalStateException: Deployment unit JAR not found
>   +_Note:_+ The issue does not reproduce if ./gradlew :ignite-examples:build 
> is run first, as that triggers deploymentUnitJar explicitly.
>   *Fix:* Added to examples/java/build.gradle:
>   tasks.withType(JavaExec).configureEach {
>       dependsOn deploymentUnitJar
>   }
>   This ensures the deployment unit JAR is always built before any example 
> class is executed via Gradle, regardless of whether build was run first.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to