Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Unexpected NoSuchMethodException During Initial Bot Testing

Joined
Aug 7, 2024
Messages
7
Hello,

Apologies if I'm a noob and missing something obvious here, but I can't seem to figure out what I'm doing wrong.

I'm trying to just make a bot walk to a given location.

However, when the bot tries to start up, I get an error:
java.lang.NoSuchMethodException: java.util.concurrent.ForkJoinWorkerThread.<init>(java.lang.ThreadGroup,java.util.concurrent.ForkJoinPool)
at java.lang.Class.getConstructor0(Class.java:3761) ~[?:?]
at java.lang.Class.getDeclaredConstructor(Class.java:2930) ~[?:?]
at com.runemate.game.api.script.framework.core.BotPlatform.<clinit>(jhd:188) ~[runemate-client-4.13.7.0.jar:?]
at com.runemate.game.api.script.framework.AbstractBot.<init>(rld:253) ~[runemate-client-4.13.7.0.jar:?]
at com.runemate.game.api.script.framework.LoopingBot.<init>(LoopingBot.java:24) ~[runemate-game-api-1.35.9.jar:?]
at com.runemate.party.ApeGoblinFighter.<init>(ApeGoblinFighter.java:17) ~[?:?]
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]


I was reading a suggestion on the discord that this might be JDK related, but I'm on jdk 17, tried two different ones.
This appears to be fatal as the bot is null after.

Am I using the wrong JDK here? JDK 17 - Temurin
Based off the setup here:
1759173432319.png

1759173453542.png
 
Joined
Aug 7, 2024
Messages
7
And here's the main/build.gradle.
* I found another thread which suggested it might be a constructor issue, tried to explicitly set the constructor but it didn't work.
* Also rebuilt project.

Java:
package com.runemate.party;
import com.runemate.game.api.hybrid.entities.Player;
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.location.navigation.cognizant.ScenePath;
import com.runemate.game.api.hybrid.region.Players;
import com.runemate.game.api.script.framework.LoopingBot;
import com.runemate.game.api.script.framework.listeners.SettingsListener;
import com.runemate.game.api.script.framework.listeners.events.SettingChangedEvent;
import com.runemate.ui.setting.annotation.open.SettingsProvider;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ApeGoblinFighter extends LoopingBot implements SettingsListener {

public ApeGoblinFighter() {
super();
}

private static final Logger logger = LogManager.getLogger(ApeGoblinFighter.class);

@SettingsProvider(updatable = true)
private CombatSettings settings;

private FightingState state = FightingState.NAVIGATING_TO_GOBLINS;

private boolean settingsConfirmed;

@Override
public void onStart(final String... arguments) {
getEventDispatcher().addListener(this);
}

@Override
public void onLoop() {
if (!settingsConfirmed) { return; }

switch (state) {
case NAVIGATING_TO_GOBLINS -> navigateToGoblin();
case FIGHTING -> fighting();
case ATTEMPTING_TO_FIGHT -> attemptingToFight();
case LOOKING_FOR_FREE_GOBLIN -> lookingForFreeGoblin();
case NAVIGATING_TO_REFRESH_IN_BANK -> navigateToRefreshInBank();
}
}

private void navigateToGoblin() {
Player player = Players.getLocal();
Coordinate goblinLocation = new Coordinate(3255, 3231);

if (player == null) {
logger.warn("Unable to find local player");
return;
}

if (player.getAnimationId() != -1) {
logger.info("Already navigating");
return;
}



ScenePath path = ScenePath.buildBetween(player, goblinLocation);

if (path == null) {
logger.info("Pathing Error");
return;
}
path.step();



//        String goblinName = "Goblin";
//        GameObject goblin = GameObjects.newQuery().names(goblinName).results().nearest();
//        if (goblin == null) {
//            logger.warn("Unable to find goblin");
//            return;
//        }
}

private void fighting() {

}

private void attemptingToFight() {

}

private void lookingForFreeGoblin() {
}

private void navigateToRefreshInBank() {
}

@Override
public void onSettingChanged(SettingChangedEvent event) {

}

@Override
public void onSettingsConfirmed() {
settingsConfirmed = true;
}

}

Code:
import com.runemate.game.api.bot.data.Accessimport com.runemate.game.api.bot.data.Category
import com.runemate.game.api.bot.data.FeatureType

plugins {
id("java")
id("com.runemate") version "1.5.0"
id ("io.freefair.lombok") version "8.6"
}

group = "com.runemate.party"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks.test {
useJUnitPlatform()
}

runemate {
devMode = true
autoLogin = true

manifests {
create("ApeGoblinFighter") {
mainClass = "com.runemate.party.ApeGoblinFighter"
tagline = "a test bot :)"
description = "Tests stuff?"
version = "1.0"
internalId = "test-bot-1234567s"

obfuscation {
+"obfuscation rule"
exclude("obfuscation rule")
exclude { "obfuscation rule" }
}
features {
required(FeatureType.DIRECT_INPUT)
}
resources {
+"resource rule"
include("resource rule")
include { "resource rule" }
}
variants {
variant(name = "My Bot", price = BigDecimal.ZERO)
}
}
}
}
 
Joined
Aug 7, 2024
Messages
7
After a few fun hours of debugging. I finally realized the issue was actually my gradle was somehow set to the wrong JVM, once I updated it I saw logs.

Fun times of being a Java/Gradle noob.

Hope this helps others.
1759183339584.png
 
Top