There can be several reasons why a java.net.BindException is thrown when initializing a TransportMapping for listening on traps or incoming SNMP requests:

  1. The port is 161 or 162 (or any other port below 1024) on an Unix system. Then you need to run your application/agent with root privileges to be able to bind that port.
  2. The port is already used by another application.
  3. The address does not belong to the local host. For example, if the local host has interfaces with address 127.0.0.1 (local loop), 192.168.0.1 (eth0), and 192.168.1.1 (eth1) then you will get a bind exception when trying to init a transport mapping on 192.168.2.1. In most cases, using 0.0.0.0/<port> is the best choice. This special address binds all available local interfaces.
  • No labels