Skip to main content

JDiamete1.5.3 Connection after running up abnormal, please help me look

2 replies [Last post]
liweiwj
Offline
Joined: 2010-05-14
Points: 0

I want to use jdiameter to write diameter NASREQ protocol, using the latest jdiameter1.5.3. But is running out, the server and client to connect abnormal
Server-side code and configuration files are:
public class DService {

private static Log log=LogFactory.getLog(DService.class);

public static void main(String args[])
{
try{
Class diameterClass=Class.forName("org.jdiameter.server.impl.StackImpl");
Stack diameter= (Stack)diameterClass.newInstance();

//load init config
XMLConfiguration conXmlConfiguration=null;
File file_config=new File(ConfigFilePath.filePath+"service_configuration.xml");
conXmlConfiguration=new XMLConfiguration(new FileInputStream(file_config));
//create sessionFactory
SessionFactory factory=diameter.init(conXmlConfiguration);
//start stack service
diameter.start();

//create a stack shared instance
StackManager.registerStack(diameter);

Session session=factory.getNewSession();
session.setRequestListener(new ServiceReqListener());

while( session.isValid() )
{
Thread.sleep(1000);
};

diameter.stop(10,TimeUnit.SECONDS);
diameter.destroy();
StackManager.deregisterStack(diameter);
// StackManager
}catch(Exception er )
{
er.printStackTrace();
}

}
}
------------------------------------------------------------------------------------------
<?xml version="1.0"?>

***************************************************************************************
The client code and configuration files are:

public static void main(String args[])
{
try{

Class diameterClass=Class.forName("org.jdiameter.client.impl.StackImpl");
Stack diameter=(Stack)diameterClass.newInstance();

//load init config
XMLConfiguration conXmlConfiguration=null;
conXmlConfiguration=new XMLConfiguration(new FileInputStream(ConfigFilePath.filePath+"clinet_configuration.xml"));
//create sessionFactory
SessionFactory factory=diameter.init(conXmlConfiguration);

diameter.start();

//create a stack shared instance
StackManager.registerStack(diameter);

Session session=factory.getNewSession();
session.setRequestListener(new ServiceReqListener());

Message msg=session.createRequest(1, ApplicationId.createByAccAppId(19302),"mobicents.org");
msg.getAvps().addAvp(100, 100);

session.send(msg);

while( session.isValid() )
{
Thread.sleep(1000);
}

session.release();

diameter.stop(10,TimeUnit.SECONDS);
diameter.destroy();
StackManager.deregisterStack(diameter);
// StackManager

}catch(Exception er )
{
er.printStackTrace();
}
}
----------------------------------------------------------------------------------------------------------------
<?xml version="1.0"?>

-->

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
liweiwj
Offline
Joined: 2010-05-14
Points: 0

Client running log is:
DEBUG - Parsed AVP: Name[Requested-Action] Description[] Code[436] May-Encrypt[yes] Mandatory[must] Protected [may] Vendor-Bit [mustnot] Vendor-Id [None] Constrained[] Type [Unsigned32]
DEBUG - Parsed AVP: Name[Requested-Service-Unit] Description[] Code[437] May-Encrypt[yes] Mandatory[must] Protected [may] Vendor-Bit [mustnot] Vendor-Id [None] Constrained[] Type [Grouped]
................................................
---name: 3GPP-IMSI, code: 1, vendor: 10415, weak: false, grouped: false, type: UTF8String, multiplicity: 0+
---name: MSISDN, code: 701, vendor: 10415, weak: false, grouped: false, type: OctetString, multiplicity: 0+]!
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
INFO - AVP Validator :: Loaded in 297ms == Vendors[12] Commands[38] Types[17] AVPs[490]
DEBUG - Destination address is set to localhost : 1812
DEBUG - Append peer Peer{Uri=aaa://127.0.0.1:1812; State=DOWN} to peer table
DEBUG - Process event Event{name:START_EVENT, key:null, object:null}
DEBUG - Connection to aaa://127.0.0.1:1812 is opened
DEBUG - Starting transport
DEBUG - Connected to peer aaa://127.0.0.1:1812
DEBUG - Send CER message
DEBUG - Transport is started
DEBUG - Send message MessageImpl{commandCode=257, flags=128} to peer aaa://127.0.0.1:1812
DEBUG - Peer{Uri=aaa://127.0.0.1:1812; State=DOWN} fsm swith state DOWN -> INITIAL
DEBUG - Process event Event{name:CONNECT_EVENT, key:aaa://localhost:1812, object:null}
DEBUG - Unknown event type: CONNECT_EVENT in state INITIAL
WARN - Validation could not be performed for Command. Code=1, Application-Id=19302, Req=true
java.util.concurrent.ScheduledThreadPoolExecutor@676437
DEBUG - Send request MessageImpl{commandCode=1, flags=128} [destHost=; destRealm=mobicents.org]
DEBUG - DestHost=null, DestRealm=mobicents.org
DEBUG - Peer by destination host avp [host=null,peer=null] has no valid connection
DEBUG - Realm mobicents.org has avaliable following peers [Peer{Uri=aaa://127.0.0.1:1812; State=INITIAL}] from list [127.0.0.1]
DEBUG - Selected peer Peer{Uri=aaa://127.0.0.1:1812; State=INITIAL} for sending message MessageImpl{commandCode=1, flags=128}
DEBUG - Process event Event{name:SEND_MSG_EVENT, key:null, object:MessageImpl{commandCode=1, flags=128}}
DEBUG - Error during processing fsm event
java.lang.RuntimeException: Connection is down
at org.jdiameter.client.impl.fsm.PeerFSMImpl$6.processEvent(PeerFSMImpl.java:547)
at org.jdiameter.client.impl.fsm.PeerFSMImpl$1.run(PeerFSMImpl.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
DEBUG - Received message
DEBUG - Receive message type 257
DEBUG - Process event Event{name:CEA_EVENT, key:aaa://localhost:1812, object:MessageImpl{commandCode=257, flags=0}}
DEBUG - Result code value 5010
DEBUG - Stopping transport
DEBUG - Connection from aaa://127.0.0.1:1812 is closed
INFO - Read thread is stopped
DEBUG - Transport is stopped
DEBUG - Disconnected from peer aaa://127.0.0.1:1812
DEBUG - Peer{Uri=aaa://127.0.0.1:1812; State=INITIAL} fsm swith state INITIAL -> REOPEN
DEBUG - Process event Event{name:DISCONNECT_EVENT, key:aaa://localhost:1812, object:null}
DEBUG - Process event Event{name:TIMEOUT_EVENT, key:null, object:null}
DEBUG - Connection to aaa://127.0.0.1:1812 is opened
DEBUG - Starting transport
DEBUG - Connected to peer aaa://127.0.0.1:1812
DEBUG - Process event Event{name:CONNECT_EVENT, key:aaa://localhost:1812, object:null}
DEBUG - Send CER message
DEBUG - Send message MessageImpl{commandCode=257, flags=128} to peer aaa://127.0.0.1:1812
DEBUG - Peer{Uri=aaa://127.0.0.1:1812; State=REOPEN} fsm swith state REOPEN -> INITIAL
DEBUG - Transport is started
DEBUG - Received message
DEBUG - Receive message type 257
DEBUG - Connection from aaa://127.0.0.1:1812 is closed
INFO - Read thread is stopped
DEBUG - Process event Event{name:CEA_EVENT, key:aaa://localhost:1812, object:MessageImpl{commandCode=257, flags=0}}
DEBUG - Result code value 5010
DEBUG - Stopping transport
DEBUG - Transport is stopped
DEBUG - Disconnected from peer aaa://127.0.0.1:1812
DEBUG - Peer{Uri=aaa://127.0.0.1:1812; State=INITIAL} fsm swith state INITIAL -> REOPEN
DEBUG - Process event Event{name:DISCONNECT_EVENT, key:aaa://localhost:1812, object:null}

liweiwj
Offline
Joined: 2010-05-14
Points: 0

Client does not connect, the server running the log:
DEBUG - Parsed AVP: Name[Service-Context-Id] Description[] Code[461] May-Encrypt[yes] Mandatory[must] Protected [may] Vendor-Bit [mustnot] Vendor-Id [None] Constrained[] Type [UTF8String]
DEBUG - Parsed AVP: Name[Service-Identifier] Description[] Code[439] May-Encrypt[yes] Mandatory[must] Protected [may] Vendor-Bit [mustnot] Vendor-Id [None] Constrained[] Type [Unsigned32]
.......................................
---name: 3GPP-IMSI, code: 1, vendor: 10415, weak: false, grouped: false, type: UTF8String, multiplicity: 0+
---name: MSISDN, code: 701, vendor: 10415, weak: false, grouped: false, type: OctetString, multiplicity: 0+]!
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
WARN - No strong avp representation for msg: name: Some-AVP, code: -2, vendor: 0, weak: false, grouped: false, type: null, multiplicity: 0
INFO - AVP Validator :: Loaded in 296ms == Vendors[12] Commands[38] Types[17] AVPs[490]
INFO - Open server socket ServerSocket[addr=/127.0.0.1,localport=1812]
--------------------------------------When the client connection after the log:-----------------------
INFO - Open incomming connection Socket[addr=/127.0.0.1,port=1716,localport=1812]
DEBUG - Starting transport
DEBUG - Transport is started
DEBUG - Received message
DEBUG - Message MessageImpl{commandCode=257, flags=128} received to peer aaa://localhost:1716
DEBUG - Receive message type 257
DEBUG - Process event Event{name:CER_EVENT, key:aaa://localhost:1716, object:MessageImpl{commandCode=257, flags=128}}
DEBUG - Add Peer{Uri=aaa://127.0.0.1:1716; State=DOWN} peer {}
DEBUG - Handle MessageImpl{commandCode=257, flags=128} message on peer Peer{Uri=aaa://127.0.0.1:1716; State=DOWN}
DEBUG - Processing CER
DEBUG - Processing CER failed... no common application, message AppIps [AppId [Vendor-Id:193; Auth-Application-Id:0; Acct-Application-Id:19302]]
DEBUG - Send CEA message
DEBUG - Send message MessageImpl{commandCode=257, flags=0} to peer aaa://127.0.0.1:1716
DEBUG - Stopping transport
DEBUG - Transport exception
java.nio.channels.AsynchronousCloseException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:185)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:263)
at org.jdiameter.client.impl.transport.tcp.TCPTransportClient.run(TCPTransportClient.java:104)
at java.lang.Thread.run(Thread.java:619)
DEBUG - Connection from aaa://127.0.0.1:1716 is closed
INFO - Read thread is stopped
DEBUG - Transport is stopped
DEBUG - Disconnected from peer aaa://127.0.0.1:1716
DEBUG - Peer{Uri=aaa://127.0.0.1:1716; State=DOWN} fsm swith state DOWN -> DOWN
DEBUG - Process event Event{name:CER_EVENT, key:aaa://localhost:1716, object:MessageImpl{commandCode=257, flags=128}}
DEBUG - Processing CER
DEBUG - Processing CER failed... no common application, message AppIps [AppId [Vendor-Id:193; Auth-Application-Id:0; Acct-Application-Id:19302]]
DEBUG - Send CEA message
DEBUG - Can not send message
java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:126)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:324)
at org.jdiameter.client.impl.transport.tcp.TCPTransportClient.sendMessage(TCPTransportClient.java:177)
at org.jdiameter.client.impl.transport.tcp.TCPClientConnection.sendMessage(TCPClientConnection.java:133)
at org.jdiameter.client.impl.controller.PeerImpl$ActionContext.sendMessage(PeerImpl.java:588)
at org.jdiameter.server.impl.PeerImpl$LocalActionConext.sendMessage(PeerImpl.java:283)
at org.jdiameter.server.impl.PeerImpl$LocalActionConext.sendCeaMessage(PeerImpl.java:138)
at org.jdiameter.server.impl.fsm.PeerFSMImpl$4.processEvent(PeerFSMImpl.java:255)
at org.jdiameter.client.impl.fsm.PeerFSMImpl$1.run(PeerFSMImpl.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
DEBUG - Failed to send CEA.
org.jdiameter.client.api.io.TransportException: Cannot send message:
at org.jdiameter.client.impl.transport.tcp.TCPClientConnection.sendMessage(TCPClientConnection.java:136)
at org.jdiameter.client.impl.controller.PeerImpl$ActionContext.sendMessage(PeerImpl.java:588)
at org.jdiameter.server.impl.PeerImpl$LocalActionConext.sendMessage(PeerImpl.java:283)
at org.jdiameter.server.impl.PeerImpl$LocalActionConext.sendCeaMessage(PeerImpl.java:138)
at org.jdiameter.server.impl.fsm.PeerFSMImpl$4.processEvent(PeerFSMImpl.java:255)
at org.jdiameter.client.impl.fsm.PeerFSMImpl$1.run(PeerFSMImpl.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Error while sending message: java.nio.channels.ClosedChannelException
at org.jdiameter.client.impl.transport.tcp.TCPTransportClient.sendMessage(TCPTransportClient.java:181)
at org.jdiameter.client.impl.transport.tcp.TCPClientConnection.sendMessage(TCPClientConnection.java:133)
... 8 more
DEBUG - Stopping transport
DEBUG - Transport is stopped
DEBUG - Disconnected from peer aaa://127.0.0.1:1716
DEBUG - Peer{Uri=aaa://127.0.0.1:1716; State=DOWN} fsm swith state DOWN -> DOWN
DEBUG - Process event Event{name:DISCONNECT_EVENT, key:aaa://localhost:1716, object:null}
DEBUG - Process event Event{name:TIMEOUT_EVENT, key:null, object:null}