Skip to content

Error 500 java.lang.AbstractMethodError: Receiver class org.wiremock.RandomHelper does not define or inherit an implementation of the resolved method abstract java.lang.Object apply #15

@zyberzebra

Description

@zyberzebra

Proposal

Proposal

I get an Error using multiple Extensions:

Error 500 java.lang.AbstractMethodError: Receiver class org.wiremock.RandomHelper does not define or inherit
        an implementation of the resolved method 'abstract java.lang.Object apply(java.lang.Object,
        wiremock.com.github.jknack.handlebars.Options)' of interface
        wiremock.com.github.jknack.handlebars.Helper.

Reproduction steps

@SpringBootApplication
public class Demo4Application {

    public static void main(String[] args) {
        SpringApplication.run(Demo4Application.class, args);
        var store = new CaffeineStore();
        WireMockServer server = new WireMockServer(
                options()
                        .port(1234)
                        .templatingEnabled(true)
                        .globalTemplating(true)
                        .extensions(new StateExtension(store))
                        .extensions(new RandomExtension())
                        .usingFilesUnderDirectory("src/main/resources")
        );
        server.start();
    }
}

The mapping:

{
  "mappings": [
    {
      "request": {
        "urlPathPattern": "/store",
        "method": "POST"
      },
      "response": {
        "status": 200,
        "body": "{{ random 'BojackHorseman.quotes'}}"
      },
      "serveEventListeners": [
        {
          "name": "recordState",
          "parameters": {
            "state": {
              "stored": "{{request.body}}"
            },
            "context": "profile"
          }
        }
      ]
    },
    {
      "request": {
        "urlPathPattern": "/stored",
        "method": "GET"
      },
      "response": {
        "body": "stored {{state context='profile' property='stored' default='nothing here'}} + a random value"

      }
    }
  ]
}

The gradle File

plugins {
    java
    id("org.springframework.boot") version "3.4.0"
    id("io.spring.dependency-management") version "1.1.6"
}

group = "zebra.zyber"
version = "0.0.1-SNAPSHOT"

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
    maven { url = uri("https://repo.spring.io/milestone") }
}

extra["springCloudVersion"] = "2024.0.0-RC1"

dependencies {
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.springframework.cloud:spring-cloud-contract-wiremock")
    implementation("org.wiremock:wiremock-standalone:3.9.2")
    implementation("org.wiremock.extensions:wiremock-faker-extension:0.2.0")
    implementation("org.wiremock.extensions:wiremock-state-extension-standalone:0.8.0")
    
    testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

dependencyManagement {
    imports {
        mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions