Getting java.net.SocketException: Unsupported address type while creating SNMP session using "::"

Hi @AGENTPP, I am trying to implement trap/inform listener and when tried to pass “::/<port>” in DefaultUdpTransportMapping encountered java.net.SocketException: Unsupported address type, while same code was working with “0.0.0.0/<port>

        String listenerAddress =  "::" + "/" + port;
		UdpAddress udpAddress = new UdpAddress(listenerAddress);

		MessageDispatcherImpl messageDispatcher;
		if (port == INFORM_PORT){
			TransportMapping<UdpAddress> transportMapping = new DefaultUdpTransportMapping(udpAddress);

Exception encountered

2024-11-25T22:15:35.662206+05:30 Machine1(86f49e651492)[2864]: java.net.SocketException: Unsupported address type
2024-11-25T22:15:35.662346+05:30 Machine1(86f49e651492)[2864]: #011at java.base/sun.nio.ch.Net.newSocketException(Net.java:193)
2024-11-25T22:15:35.662374+05:30 Machine1(86f49e651492)[2864]: #011at java.base/sun.nio.ch.Net.translateToSocketException(Net.java:175)
2024-11-25T22:15:35.662406+05:30 Machine1(86f49e651492)[2864]: #011at java.base/sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:110)
2024-11-25T22:15:35.662435+05:30 Machine1(86f49e651492)[2864]: #011at java.base/java.net.DatagramSocket.createDelegate(DatagramSocket.java:1425)
2024-11-25T22:15:35.662459+05:30 Machine1(86f49e651492)[2864]: #011at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:328)
2024-11-25T22:15:35.662479+05:30 Machine1(86f49e651492)[2864]: #011at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:387)
2024-11-25T22:15:35.662498+05:30 Machine1(86f49e651492)[2864]: #011at org.snmp4j.transport.DefaultUdpTransportMapping.<init>(DefaultUdpTransportMapping.java:105)
2024-11-25T22:15:35.662519+05:30 Machine1(86f49e651492)[2864]: #011at <package>.setUpSnmpSession(testing.java:95)

How can this be fixed?
Thanks in advance

This is now resolved, somehow System.setProperty("java.net.preferIPv4Stack", "false") was not getting picked up during start-up of application. After configuring it correctly it started working.

Thanks