triplea icon indicating copy to clipboard operation
triplea copied to clipboard

UnifiedInvocationHandler#invoke:57 - java.lang.IllegalArgumentException

Open tripleabuilderbot opened this issue 7 months ago • 7 comments

Map

shogun_advanced / Shogun Advanced

Log Message

Exception on remote

TripleA Version

2.7.15086

Java Version

21.0.7

Operating System

Windows 11

Heap Size

3912M

Stack Trace

Exception: java.lang.RuntimeException Exception on remote
java.lang.Exception
	at games.strategy.engine.message.UnifiedInvocationHandler.invoke(UnifiedInvocationHandler.java:57)
	at jdk.proxy2/jdk.proxy2.$Proxy20.fightBattle(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at games.strategy.engine.player.PlayerBridge$GameOverInvocationHandler.invoke(PlayerBridge.java:154)
	at jdk.proxy2/jdk.proxy2.$Proxy20.fightBattle(Unknown Source)
	at games.strategy.triplea.ai.AbstractAi.battle(AbstractAi.java:613)
	at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:520)
	at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:614)
	at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:463)
	at games.strategy.engine.framework.ServerGame.runNextStep(ServerGame.java:350)
	at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:317)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:92)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
	at java.base/java.lang.Thread.run(Thread.java:1583)


Exception: java.lang.IllegalArgumentException No resource named: techTokens
java.lang.Exception
	at games.strategy.engine.data.ResourceList.lambda$getResourceOrThrow$0(ResourceList.java:36)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at games.strategy.engine.data.ResourceList.getResourceOrThrow(ResourceList.java:36)
	at games.strategy.triplea.delegate.battle.BattleTracker.takeOver(BattleTracker.java:717)
	at games.strategy.triplea.delegate.battle.MustFightBattle.attackerWins(MustFightBattle.java:1430)
	at games.strategy.triplea.delegate.battle.MustFightBattle.endBattle(MustFightBattle.java:462)
	at games.strategy.triplea.delegate.battle.steps.change.CheckGeneralBattleEnd.execute(CheckGeneralBattleEnd.java:64)
	at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:34)
	at games.strategy.triplea.delegate.battle.MustFightBattle.fight(MustFightBattle.java:690)
	at games.strategy.triplea.delegate.battle.BattleDelegate.fightBattle(BattleDelegate.java:243)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at games.strategy.engine.delegate.DelegateExecutionManager$1.invoke(DelegateExecutionManager.java:120)
	at jdk.proxy2/jdk.proxy2.$Proxy20.fightBattle(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeSingle(EndPoint.java:137)
	at games.strategy.engine.message.unifiedmessenger.EndPoint.lambda$invokeMultiple$0(EndPoint.java:121)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeMultiple(EndPoint.java:122)
	at games.strategy.engine.message.unifiedmessenger.EndPoint.invokeLocal(EndPoint.java:112)
	at games.strategy.engine.message.unifiedmessenger.UnifiedMessenger.invokeAndWait(UnifiedMessenger.java:97)
	at games.strategy.engine.message.UnifiedInvocationHandler.invoke(UnifiedInvocationHandler.java:55)
	at jdk.proxy2/jdk.proxy2.$Proxy20.fightBattle(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at games.strategy.engine.player.PlayerBridge$GameOverInvocationHandler.invoke(PlayerBridge.java:154)
	at jdk.proxy2/jdk.proxy2.$Proxy20.fightBattle(Unknown Source)
	at games.strategy.triplea.ai.AbstractAi.battle(AbstractAi.java:613)
	at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:520)
	at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:614)
	at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:463)
	at games.strategy.engine.framework.ServerGame.runNextStep(ServerGame.java:350)
	at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:317)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:92)
	at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
	at java.base/java.lang.Thread.run(Thread.java:1583)


tripleabuilderbot avatar Jun 19 '25 10:06 tripleabuilderbot

@frigoref Using 2.7.15086 the above occurs 3 out 3 times on turn 2. Load game, set all AI for Fast, Play

The game has no Tech Tokens, however there is a fix to not display the Tech Grid by

lines 2055

<!--
	<delegate name="userActions" javaClass="games.strategy.triplea.delegate.UserActionDelegate" display="User Actions"/>
	<delegate name="tech" javaClass="games.strategy.triplea.delegate.TechnologyDelegate" display="Research Technology"/>
	<delegate name="tech_activation" javaClass="games.strategy.triplea.delegate.TechActivationDelegate" display="Technical advancements"/>
-->

From the xml line 2640

<!-- below removes the Tech grid on the Players tab	& no tech properties defined -->
  <technology>
  </technology>

Despite the above, ideally what should happen is when the 2 tech delegates are not defined the Tech grid on the Players tab should not be displayed, yes?

TheDog-GH avatar Jun 19 '25 10:06 TheDog-GH

@BBlaza Do you want to take this up as it is related to your StatsPanel split up change?

frigoref avatar Jun 19 '25 10:06 frigoref

@frigoref Sure I will look it up later

BBlaza avatar Jun 19 '25 14:06 BBlaza

@TheDog-GH You said "The game has no Tech Tokens, however there is a fix to not display the Tech Grid by......" How does displaying Tech Grid relate to Tech Token? I thought it's the problem of BattleTracker trying to access Token while it was not used. Or you just mentioned another bug?

BBlaza avatar Jun 20 '25 02:06 BBlaza

@BBlaza TripleA 2.7.15032 worked as intended, yes with my fix to not display the Tech Grid.

But now...

Yes there is no Tech Tokens. Yes there is a fix to not display the Tech Grid

How does displaying Tech Grid relate to Tech Token? Yes that is the question for you :)

I thought it's the problem of BattleTracker trying to access Token while it was not used. Is it? I only tested using the FastAI and did not look where it occurred

This might be relevant or not https://github.com/triplea-game/triplea/issues/13481

TheDog-GH avatar Jun 20 '25 07:06 TheDog-GH

@TheDog-GH I thought that the problem you mentioned in commnent is that the Tech Grid will display when when delegates were not defined.

The error report is talking about accessing tech token when token was not used, so there are two different bugs.

If my assumption is correct, the error should occur when the token was not used but delegates were defined right? I don't know why you mention the Tech Grid here. Or I misundertood?

BBlaza avatar Jun 20 '25 08:06 BBlaza

@TheDog-GH #13497 This pr should avoid the error message of not using tech token. However, the Tech Grid probably would still be shown even if the delegates were not defined

BBlaza avatar Jun 20 '25 08:06 BBlaza

@BBlaza Tested with 2.7.15097, thank you for fixing this issue!

Also thanks for putting the Tech table in its own tab, when you have a lot of tech, its much easier to find, as in my 1888A Steam & Steel map, image below. Notice the last 3 columns have no tech, it would be really cool if these could be removed from the table?

Here is a discussion on how to remove the columns https://github.com/orgs/triplea-game/projects/9/views/1?pane=issue&itemId=67004864&issue=triplea-game%7Ctriplea%7C12636

Here the feature request https://github.com/orgs/triplea-game/projects/9/views/1?pane=issue&itemId=67012253&issue=triplea-game%7Ctriplea%7C12635

Here TripleA Projects list https://github.com/orgs/triplea-game/projects/9

Image

TheDog-GH avatar Jun 23 '25 08:06 TheDog-GH

@TheDog-GH Very glad to see my pr helping you!

BBlaza avatar Jun 24 '25 01:06 BBlaza