pulumi / pulumi/pulumi-java

pulumi java-gradle fails with cryptic message

Open
#817 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

impact/usability kind/bug
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

What happened?

when build.gradle main class script changed from

 mainClass = project.hasProperty("mainClass")
            ? project.getProperty("mainClass")
            : 'com.tejasoft.devops.iac.pulumi.gradle.GradlePulumiApp'

to
mainClass = 'com.tejasoft.devops.iac.pulumi.gradle.GradlePulumiApp'

then pulumi about

fails with exception

G:\DWork\osource\cloudc\devops\pulumi\java\java-gradle>pulumi about
Exception in thread "main" java.lang.IllegalArgumentException: Program run without the Pulumi engine available; re-run using the `pulumi` CLI

        at com.pulumi.deployment.internal.DeploymentImpl$DeploymentState.lambda$fromEnvironment$2(DeploymentImpl.java:1627)

        at com.pulumi.core.Left.orThrow(Left.java:57)

        at com.pulumi.deployment.internal.DeploymentImpl$DeploymentState.fromEnvironment(DeploymentImpl.java:1632)

        at com.pulumi.deployment.internal.DeploymentImpl.fromEnvironment(DeploymentImpl.java:158)

        at com.pulumi.internal.PulumiInternal.fromEnvironment(PulumiInternal.java:39)

        at com.pulumi.Pulumi.runAsync(Pulumi.java:39)

        at com.pulumi.Pulumi.run(Pulumi.java:28)

        at com.tejasoft.devops.iac.pulumi.gradle.GradlePulumiApp.main(GradlePulumiApp.java:10)

Caused by: java.lang.IllegalArgumentException: expected environment variable: 'PULUMI_MONITOR', got: [DCA_BU_ROOT..]

        at com.pulumi.core.internal.Environment.getEnvironmentVariable(Environment.java:42)

        ... 6 more

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:run'.

> Process 'command 'D:\Apps\Dev\langs\java\jdk\17.x\bin\java.exe'' finished with non-zero exit value 1

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

CLI
Version      3.38.0
Go Version   go1.19
Go Compiler  gc

Plugins
NAME  VERSION
java  unknown

Host
OS       Microsoft Windows 10 Pro
Version  10.0.19045 Build 19045
Arch     x86_64

This project is written in java: executable='d:\Apps\Dev\langs\java\jdk\17.x\bin\java.exe' version='java 17.0.2 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)' java='d:\Apps\Dev\langs\java\jdk\17.x\bin\java.exe' javac='17.0.2'

Backend
Name           pulumi.com
URL            https://app.pulumi.com/nagkumar
User           nagkumar
Organizations  nagkumar, tejasoft

No dependencies found

Pulumi locates its logs in C:\Users\RAJANA~1\AppData\Local\Temp by default
warning: Failed to get information about the current stack: No current stack

Steps to reproduce

change build main class as said above

Expected Behavior

it should at least give proper error.. that is more easy to understand

Actual Behavior

exception..

Output of pulumi about

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build.gradle and GradlePulumiApp.java at the reported main entry point, then inspect DeploymentImpl.java and Environment.java where the exception is raised. Reproduce with pulumi about after removing the mainClass property; done means the failure reports a clearer, actionable error for running the program without the Pulumi engine.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.