I am trying to run the client-server example I have found here => examples/guide1 but it does not seem to be working as it is supposed to.
Although the message seems to reach the server and an answer is received, method "processRequest" of ExampleServer is never called which means that the message is never actually processed. As I said "receivedSuccessMessage" is called on the client but it only processes the original message.
I see that the message is received in the server because of this log in the server log: "Receive message type [686] to peer [aaa://localhost:47269]"
I have also noticed that there are two StackImpl classes one can be found under "org.jdiameter.server.impl" while the other is under "org.jdiameter.client.impl". However the Client uses the one under Server which seems strange and from a quick glance they are not the same.
I also cannot find the javadocs and the only documentation I found is here which does not really say much.
Ok, I solved most part of my problem.
First and foremost the jdiameter
version cannot be resolved via Maven and it needs to be changed (this is not an issue I mentioned above, but it is good to know). I used 1.5.6.0.-build501. Also use Java 1.6 (i.e. via maven-compiler-plugin) to avoid ugly compilation errors. (Build path specifies Java 1.5, I have 1.6 and/or above on my machine).
Regarding my second question, StackImpl
under org.jdiameter.server.impl
implements the one under org.jdiameter.client.impl
. However you cannot use that with the client (at least in this example). Not sure why they did this. Also the client configuration uses the server's XMLConfiguration
package org.jdiameter.server.impl.helpers.XMLConfiguration
instead of the one under org.jdiameter.server.impl.helpers
. It cannot use the one in the client package.
So in order for the example to work as it is supposed to you need to change the code in the ExampleClient.java
. Specifically the following method.
private void sendNextRequest(int enumType) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException {
Request r = this.session.createRequest(commandCode, this.authAppId, realmName);
AvpSet requestAvps = r.getAvps();
Avp exchangeType = requestAvps.addAvp(exchangeTypeCode, (long) enumType, vendorID, true, false, true);
Avp exchengeData = requestAvps.addAvp(exchangeDataCode, TO_SEND[toSendIndex++], vendorID, true, false, false);
requestAvps.addAvp(Avp.DESTINATION_HOST, "127.0.0.1", true, false, true);
this.session.send(r, this);
dumpMessage(r,true);
}
serverURI
should be removed from createRequest
and the AVP 293 (DESTINATION HOST) should match the server's host.
I discovered this after meticulously studying the log file and with a lot of debugging.
DEBUG PeerTableImpl - In getPeerByName for peer name [aaa://127.0.0.1:3868]. going to loop through peerTable and find a matching entry
DEBUG PeerTableImpl - Checking to see if peer name [aaa://127.0.0.1:3868] matches peertable value of [aaa://127.0.0.1:49150] or [127.0.0.1]
DEBUG controller.PeerTableImpl - No peer found in getPeerByName for peer [aaa://127.0.0.1:3868] will return null
Please also notice that there is a missing '3' from the applicationID member of both ExampleClient.java
and ExampleServer.java
. This does not seem to affect the example but if you start messing around with the configuration you might face issues like this:
DEBUG org.jdiameter.client.impl.parser.MessageImpl - Application Ids in this message are:
DEBUG org.jdiameter.client.impl.parser.MessageImpl - [AppId [Vendor-Id:0; Auth-Application-Id:33333; Acct-Application-Id:0]]
DEBUG org.jdiameter.client.impl.parser.MessageImpl - Returning [AppId [Vendor-Id:0; Auth-Application-Id:33333; Acct-Application-Id:0]] as the first application id because there are no vendor specific ones found
DEBUG org.jdiameter.client.impl.controller.PeerImpl - Could not process request. Result Code = [3007], Error Message: [null]
DEBUG org.jdiameter.client.impl.controller.PeerImpl - Sending response indicating we could not process request