Problem seid Exception Handling
Hi,
habe leider seid heute ein Problem :(
Nachdem ich SIMON in mein Projekt eingebaut habe habe ich alles getestet und es hat funktioniert.
Ich programmiere ein 2 Spieler Brettspiel, dass über einen Server läuft, der die beiden ClientInterfaces sich merkt und wenn ein Spieler am Zug ist, die entsprechenden Methoden aufruft.
Meine Testklasse habe ich sowohl lokal als auch remote getestet und sie hat funktioniert! Vielen Dank schonmal, SIMON ist echt eine super Sache.
Jetzt aber zu meinem Problem. Heute habe ich alle Exceptions (vorher stand überall nur throw new Exception(text)) in eigene Exceptionklassen aufgesplittet, um die verschiedenen Exceptions besser zu unterscheiden. Jetzt ist alles fertig, aber mein Spiel funktioniert nicht mehr :/
Der Fehlercode auf dem Server:
1Exception in thread "Simon.Dispatcher.WorkerPool.#2" de.root1.simon.exceptions.SimonException: An error occured while reading a message for remote object 'PRDKH'. Error message: Error while decoding invoke request
2 at de.root1.simon.ProcessMessageRunnable.processError(ProcessMessageRunnable.java:700)
3 at de.root1.simon.ProcessMessageRunnable.run(ProcessMessageRunnable.java:178)
4 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
5 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
6 at java.lang.Thread.run(Unknown Source)
7Caused by: java.lang.NullPointerException
8 at de.root1.simon.codec.base.MsgInvokeDecoder.decodeBody(MsgInvokeDecoder.java:70)
9 at de.root1.simon.codec.base.AbstractMessageDecoder.decode(AbstractMessageDecoder.java:97)
10 at org.apache.mina.filter.codec.demux.DemuxingProtocolDecoder.doDecode(DemuxingProtocolDecoder.java:178)
11 at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:178)
12 at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:241)
13 at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
14 at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
15 at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
16 at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
17 at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
18 at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
19 at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:693)
20 at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:646)
21 at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:635)
22 at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:67)
23 at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1079)
24 at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
25 ... 3 more
Woher könnte dieser Fehler, der nun auf einmal auftritt stammen? :(
Viele Grüße und ein Lob für das tolle Projekt,
Sadawys
Replies (2)
RE: Problem seid Exception Handling - Added by Sadawys 5 months ago
Noch eine Ergänzung:
Mein Serverinterface sieht nun so aus:
1package rmi;
2
3import java.util.List;
4import java.util.Map;
5
6import spiel.Raumschifftyp;
7import spiel.karten.Karte;
8import spiel.planeten.Planet;
9import spiel.waren.Ware;
10
11import de.root1.simon.SimonRemote;
12import de.root1.simon.exceptions.SimonRemoteException;
13import exceptions.FalscheZugreihenfolgeException;
14import exceptions.FalscherKartentypException;
15import exceptions.FalscherPlanetException;
16import exceptions.FalscherSpielertypException;
17import exceptions.FalscherStandortException;
18import exceptions.FlugAusserhalbDesSpielbrettsException;
19import exceptions.GewuenschteFluglaengeZuLangException;
20import exceptions.InterventionNichtAusgespieltException;
21import exceptions.InvalideLagernummerException;
22import exceptions.InvalidePlanetennummerException;
23import exceptions.InvaliderNameOderPasswortException;
24import exceptions.KarteUndAblageStapelNichtVonDemselbenSpielerException;
25import exceptions.KeinFreierLagerraumVorhandenException;
26import exceptions.KeineOrbitalaktionException;
27import exceptions.KeineSpielerklasseGefundenException;
28import exceptions.LagernummerNichtGesetztException;
29import exceptions.ObjektIstNichtNullException;
30import exceptions.ObjektIstNullException;
31import exceptions.SonnentunnelNichtOffenException;
32import exceptions.SpielerHatDieseKarteNichtAufDerHandException;
33import exceptions.SpielerHatKeineInterventionenMehrException;
34import exceptions.SpielerHatKeinePlanetenaktionMehrException;
35import exceptions.SpielerHatKeinenNachschubMehrException;
36import exceptions.SpielerHatSchonFuenfHandkartenException;
37import exceptions.SpielerIstIngameException;
38import exceptions.SpielerIstNichtEingeloggtException;
39import exceptions.SpielerIstNichtAnDerReiheException;
40import exceptions.SpielerIstNichtIngameException;
41import exceptions.SpielerIstSchonEingeloggtException;
42import exceptions.SpielleiterIstBeendetException;
43import exceptions.SpielzugNichtGestartetException;
44import exceptions.TechnologieNichtVorhandenException;
45import exceptions.WarenAufDemPlanetenNichtVorhandenException;
46import exceptions.WarenHabenNichtAlleDenGleichenTypException;
47import exceptions.WarenImLagerraumNichtVorhandenException;
48import exceptions.WarenMuessenVomTypDesPlanetenSeinException;
49
50@SuppressWarnings("deprecation")
51public interface ServerInterface extends SimonRemote {
52
53 public void ausloggen(ClientInterface client) throws SpielerIstIngameException, SpielerIstNichtEingeloggtException, SimonRemoteException;
54
55 public void beendeSpiel(ClientInterface client) throws SpielerIstNichtIngameException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielleiterIstBeendetException;
56
57 public void beendeSpielzug(ClientInterface client) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, SpielerIstNichtIngameException, KeineSpielerklasseGefundenException, SpielleiterIstBeendetException;
58
59 public void beginneSpielzug(ClientInterface client) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException;
60
61 public void beladeContainer(ClientInterface client, List<Ware> waren) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, FalscherPlanetException, KeineOrbitalaktionException, FalscherStandortException, KeinFreierLagerraumVorhandenException, WarenAufDemPlanetenNichtVorhandenException, WarenMuessenVomTypDesPlanetenSeinException, WarenHabenNichtAlleDenGleichenTypException, SpielerHatKeinePlanetenaktionMehrException, SpielerIstNichtIngameException;
62
63 public void beliebigemSpielbeitreten(ClientInterface client, Raumschifftyp typ) throws SpielerIstNichtEingeloggtException, SimonRemoteException, SpielerIstIngameException, ObjektIstNullException;
64
65 public void entladeContainer(ClientInterface client, int lagernummer, Ware ablegen1, Ware ablegen2)
66 throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, InvalideLagernummerException, FalscherPlanetException, KeineOrbitalaktionException, FalscherStandortException, WarenMuessenVomTypDesPlanetenSeinException, WarenHabenNichtAlleDenGleichenTypException, WarenImLagerraumNichtVorhandenException, SpielerHatKeinePlanetenaktionMehrException;
67
68 public void fliegeRichtungSonne(ClientInterface client, int fluglaenge, boolean landen) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, GewuenschteFluglaengeZuLangException, FalscherStandortException, SonnentunnelNichtOffenException;
69
70 public void fliegeRichtungWeltraum(ClientInterface client, int fluglaenge, boolean landen) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, GewuenschteFluglaengeZuLangException, FalscherStandortException, FlugAusserhalbDesSpielbrettsException, SpielerIstNichtIngameException, KeineSpielerklasseGefundenException;
71
72 public Map<String, Onlinestatus> getSpielerOnline() throws SimonRemoteException;
73
74 public void karteabwerfen(ClientInterface client, Karte karte) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, SpielerHatDieseKarteNichtAufDerHandException;
75
76 public void karteAusspielen(ClientInterface client, Karte karte) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, SpielerHatDieseKarteNichtAufDerHandException, FalscherKartentypException, SpielzugNichtGestartetException, SpielerHatKeineInterventionenMehrException, KarteUndAblageStapelNichtVonDemselbenSpielerException, FalscherSpielertypException, SpielerHatKeinePlanetenaktionMehrException, LagernummerNichtGesetztException;
77
78 public void kartenziehen(ClientInterface client, int anzahlKarten) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, SpielerHatKeinenNachschubMehrException, SpielerHatSchonFuenfHandkartenException;
79
80 public void ladeAußen(ClientInterface client, Planet planet, List<Ware> waren) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, InterventionNichtAusgespieltException, FalscherPlanetException, WarenHabenNichtAlleDenGleichenTypException, KeinFreierLagerraumVorhandenException, WarenAufDemPlanetenNichtVorhandenException, WarenMuessenVomTypDesPlanetenSeinException;
81
82 public void ladeInnen(ClientInterface client, Planet planet, List<Ware> waren) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, InterventionNichtAusgespieltException, FalscherPlanetException, WarenHabenNichtAlleDenGleichenTypException, KeinFreierLagerraumVorhandenException, WarenAufDemPlanetenNichtVorhandenException, WarenMuessenVomTypDesPlanetenSeinException;
83
84 public Map<String, Onlinestatus> login(ClientInterface client) throws SimonRemoteException, SpielerIstSchonEingeloggtException, ObjektIstNullException, InvaliderNameOderPasswortException;
85
86 public void neuesSpielerstellen(ClientInterface client, Raumschifftyp typ) throws SpielerIstNichtEingeloggtException, SimonRemoteException, SpielerIstIngameException, ObjektIstNullException;
87
88 public void setzeRaumschiffe (ClientInterface client, int planet) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, InvalidePlanetennummerException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, ObjektIstNichtNullException;
89
90 public void spieleMitSpieler (ClientInterface client, String nameFreund) throws SpielerIstNichtEingeloggtException, SimonRemoteException, SpielerIstIngameException, ObjektIstNullException, FalscherSpielertypException;
91
92 public void springeNachAußen(ClientInterface client) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, TechnologieNichtVorhandenException, FalscheZugreihenfolgeException;
93
94 public void springeNachInnen(ClientInterface client) throws SpielerIstNichtAnDerReiheException, SimonRemoteException, KeineSpielerklasseGefundenException, SpielerIstNichtIngameException, TechnologieNichtVorhandenException, FalscheZugreihenfolgeException;
95
96}
Überall wo nun throw ... steht hat früher nur throw Exception gestanden
RE: Problem seid Exception Handling - Added by Sadawys 4 months ago
Hi,
ich habe den Fehler gefunden. Da stand noch ein Simon.release Restcode im Client, der irgendwann ausgeführt wurde :/
Trotzdem vielen Dank für das Forum :)
(1-2/2)