gradle / gradle/actions

class cast from DependencyExtractorBuildService to DependencyExtractor failed on self-hosted runner

Open
#223 7 comments 2 reactions 0 assignees View on GitHub
bug in:dependency-submission
Dominant language
TypeScript
Stars
340
Forks
117
Avg merge
1d 9h
Merged PRs (30d)
11

Description

Hi,
I tried setting up the dependency-submission action on my public repo, but it failed due to a cast error like in #146 and [#132 of the gradle plugin](https://github.com/gradle/github-dependency-graph-gradle-plugin/issues/132).
Since it still seems to be a bit unclear what causes this, I will try to provide as many information about my situation as possible. If there's more I can give, feel free to ask.

**my environment**
- multi-module project
- using JDK 17 and gradle 8.6
- self-hosted runner on manjaro (release 23.1.4) virtual machine (KVM/QEMU)
- using only in workflow, not as local plugin (see section of what I tried)
- pretty much the standard workflow-yaml:
```
name: Dependency submissions
on:
- pull_request

permissions:
contents: write

jobs:
dependency-submission:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
with:
dependency-graph-continue-on-failure: true
```

**What I expected**
Well, a green check mark on the actions job and a list of dependencies on my repo for the dependabot. ^^

**What I got**
```
class org.gradle.dependencygraph.extractor.DependencyExtractorBuildService$Inject cannot be cast to class org.gradle.dependencygraph.extractor.DependencyExtractor (org.gradle.dependencygraph.extractor.DependencyExtractorBuildService$Inject is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @16afcba6; org.gradle.dependencygraph.extractor.DependencyExtractor is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @64f8f28c)
```

**What I tried so far**
- I tried using a completely fresh GitHub runner (v2.136.1) -> no effect
- I tried [running it locally](https://github.com/gradle/github-dependency-graph-gradle-plugin?tab=readme-ov-file#using-the-plugin-to-generate-dependency-reports) -> worked locally, but didn't quite meet my plan to keep the repo as clean as possible
- I tried pinning the gradle version and working-root to the most important module. -> didn't work either

I at least hope contributing any insights on the underlying issue. Of course, if I can try anything else to resolve the issue, I would be more than happy to try it. :)
Please make me aware, if I missed a solution of this issue some where.

Contributor guide

Open the contributing guide

Research direction

Start with the dependency-submission workflow in the issue and reproduce the cast error using the stated JDK 17, Gradle 8.6, multi-module project, and self-hosted runner environment. No source file or test is identified; done would require determining the cause of the class-loading failure and confirming that the action completes with a dependency graph.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, java
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.