jdiameter icon indicating copy to clipboard operation
jdiameter copied to clipboard

Issue Network Unwrap

Open albertpv opened this issue 6 years ago • 2 comments

When starting JDiameter I have issue in following piece of code unwrapping the network and adding the network listener:

config = new XMLConfiguration(is);
logger.info("Client Stack config loaded!");
        serverURI = "aaa://" + serverHost + ":" + serverPort;
        logger.info("RXConnector: setup to send Rx Request to ip :"+ serverHost+ " uri:"+serverURI);
		clientFactory = clientStack.init(config);
        Network network = null;
        try{
			 **network = clientStack.unwrap(Network.class);**
             network.addNetworkReqListener(this, this.authAppId); //passing our example app id.
        }catch(Exception e){
			logger.error("cannot add network listener :-( "+e);
			e.printStackTrace();
		}
		if(is!=null){
			is.close();
		}

Then as network request listener is not successfully added do not receive callbacks on diameter answers send to my client. However my client can successfully send diameter requests without issues after catching the exception.

What could be cause of this issue in Network unwrap?

3693 [main] INFO org.jdiameter.client.impl.StackImpl - (-)(-)(-)(-)(-) Started Mobicents DIAMETER Stack v1.7.0.109 (-)(-)(-)(-)(-)

(logs) 3707 [main] ERROR root - cannot add network listener :-( java.lang.NullPointerException java.lang.NullPointerException at org.jdiameter.client.impl.StackImpl.unwrap(StackImpl.java:441) at net.xxx.yyy.RxClient.(RxClient.java:104) at net.xxx.yyy.RxConnector.main(RxConnector.java:53) 3861 [main] INFO root - Client Stack started! 3864 [main] INFO root - local peer [CPeer{Uri=aaa://10.81.194.131:3868; State=DOWN; Con=org.jdiameter.client.impl.transport.tcp.TCPClientConnection@2ff55105}] 4266 [main] INFO org.mortbay.log - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog

albertpv avatar Dec 14 '17 17:12 albertpv