好的,我解決了我的問題的大部分。
首先,最重要的是jdiameter
版本無法通過Maven解決,需要更改(這不是我上面提到的問題,但很好知道)。我用1.5.6.0.-build501。也可以使用Java 1.6(即通過maven-compiler-plugin)來避免醜陋的編譯錯誤。 (構建路徑指定Java 1.5,我的機器上有1.6和/或更高版本)。
關於我的第二個問題,StackImpl
在org.jdiameter.server.impl
下實現了org.jdiameter.client.impl
下的那個。但是你不能在客戶端使用它(至少在這個例子中)。不知道他們爲什麼這麼做。此外,客戶端配置使用服務器的XMLConfiguration
包org.jdiameter.server.impl.helpers.XMLConfiguration
而不是org.jdiameter.server.impl.helpers
下的包。它不能使用客戶端軟件包中的那個。
因此,爲了讓示例正常工作,您應該更改ExampleClient.java
中的代碼。具體如下的方法。
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
應該從createRequest
和AVP 293(目標主機)被刪除應該與服務器的主機。
我在仔細研究了日誌文件並進行了大量調試後發現了這一點。
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
也請注意,存在丟失「3」來自ExampleClient.java
和ExampleServer.java
的的applicationID成員。這似乎沒有影響這個例子,但如果你開始搞亂配置,你可能會遇到這樣的問題:
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