2014-10-10 42 views
0

我試圖運行我在這裏找到的客戶機 - 服務器示例=>examples/guide1,但它似乎沒有像預期的那樣工作。Mobicents jDiameter git上的示例有什麼問題

雖然消息似乎到達服務器並收到答案,但ExampleServer的方法「processRequest」從不會被調用,這意味着消息從未實際處理過。正如我所說的「receivedSuccessMessage」在客戶端被調用,但它只處理原始消息。

我看到該消息被接收在所述服務器,因爲該日誌在服務器日誌的: 「接收郵件類型[686]對等[AAA://本地主機:47269]」

我還注意到有兩個StackImpl類可以在「org.jdiameter.server.impl」下找到,而另一個在「org.jdiameter.client.impl」下。然而,客戶端使用服務器下的那個看起來很奇怪的東西,並且從一眼就看出它們不一樣。

我也無法找到javadocs,我發現的唯一文檔是here,這並沒有太多的說法。

回答

2

好的,我解決了我的問題的大部分。

首先,最重要的是jdiameter版本無法通過Maven解決,需要更改(這不是我上面提到的問題,但很好知道)。我用1.5.6.0.-build501。也可以使用Java 1.6(即通過maven-compiler-plugin)來避免醜陋的編譯錯誤。 (構建路徑指定Java 1.5,我的機器上有1.6和/或更高版本)。

關於我的第二個問題,StackImplorg.jdiameter.server.impl下實現了org.jdiameter.client.impl下的那個。但是你不能在客戶端使用它(至少在這個例子中)。不知道他們爲什麼這麼做。此外,客戶端配置使用服務器的XMLConfigurationorg.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.javaExampleServer.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