Brent Ditri | 25 Aug 01:25 2015

Not Receiving Report PDUs on event.getResponse()


I am using SNMP4J's SNMPv3 implementation to perform get requests for
switches and routers in my network. I am sending these request
asynchronously via ResponseListener.

When SNMPv3 is working as intended to the devices I am able to call
event.getResponse when onResponse is called via the examples given from the
website. However, when my switch sends back a Report indicating an error I
get null when calling event.getResponse().

In wireshark I see a get-request go out, and immediately a report to
( is sent back (in this case a usmStatsNotInTimeWindows
error report is getting sent back). My expectation when calling
event.getResponse() was to receive a PDU of type PDU.REPORT and be able to
parse this PDU for the specific error message. Instead I get a null
returned which according to javadocs is indicative of a timeout error;
however, that is not in actuality what is happening. I would like to be
able to log specific USM errors reported by the device, but without
receiving the Report PDU when onResponse() is called I'm not sure how I can
go about doing it.

Has anyone else encountered this problem? Any help would be greatly

Thanks much for your time,
SNMP4J mailing list
SNMP4J <at>
(Continue reading)

David Ishmael | 7 Aug 18:17 2015

PDU Trap Version

Hey all - What is the best way to determine the PDU version in a trap receiver using SNMP4J?  Here’s what I
have and I think this works but I’m wondering if there’s a better way...

public synchronized void processPdu(CommandResponderEvent cmdRespEvent) {
	PDU pdu = cmdRespEvent.getPDU();
	switch(pdu.getType()) {
		case PDU.V1TRAP:

		case -89: // v2c?

		default:  // v3?

Thanks, Dave
SNMP4J mailing list
SNMP4J <at>
Frank Fock | 2 Jul 00:07 2015

Re: Extracting Trap properties via SMI-PRO

Hi René,

The notification objects retrieval is not supported yet in version 1.6.0 
or earlier.
It will be added in version 1.7.0 which will be available as a free 
upgrade to
all 1.x users on next Monday (July 6th).

Hope this helps.

Best regards,

Am 01.07.2015 um 19:18 schrieb René Scholl:
> Dear all,
> I am using SNMP4J - SMI -PRO within my application to compile MIB files and
> gather properties of managed objects specified within these files.
> Whenever I look up a specific OID and it happens to be of type
> 'SmiObjectType' or 'SmiValueType' and access the methods those interfaces
> offer.
(Continue reading)

René Scholl | 1 Jul 19:18 2015

Extracting Trap properties via SMI-PRO

Dear all,

I am using SNMP4J - SMI -PRO within my application to compile MIB files and
gather properties of managed objects specified within these files.

Whenever I look up a specific OID and it happens to be of type
'SmiObjectType' or 'SmiValueType' and access the methods those interfaces

I run into problems when the SmiObject  is of  SMI-Type 'TRAP_TYPE' or
'NOTIFICATION_TYPE'.  If I inspect such a before mentioned SmiObject -
instance in a debugger,  I can see it contains an MIBNotifyType - Object
offering the trap's enterprise attribute and contained varbinds. 

However I cannot figure out how to access these information. I tried to cast
the SmiObject to MibNotifyType without success. More over I did not find out
any other interface or class I can utilize. 

My goal is to extract  the trap's varbinds to gather further information on
their syntax, potential range etc.

How can i do that ?

Thank you in advance and kind regards, 


This email has been protected by YAC (Yet Another Cleaner)
(Continue reading)

obada.j | 31 May 22:19 2015
obada.j | 29 May 00:06 2015
Thomas L | 26 May 22:13 2015

BindException: Address already in use, even with reuseAddress=true (with proposed fix)


I think I have found a bug in SNMP4J (2.3.3) where we can have a "BindException: Address already in use"
exception when creating a DefaultUdpTransportMapping, whereas reuseAddress=true, if we have
previously created and closed a similar DefaultUdpTransportMapping.
In DefaultUdpTransportMapping.close(), the listener thread (WorkerTask) is not "joined", so it can
still use the UDP port for some time, and creating a new DefaultUdpTransportMapping on the same port, even
if reuseAddress=true, is not possible.
My current dirty workaround is to access the "WorkerTask" field by reflection just before closing the Snmp
object, and then calling "join()" on the object, so I am sure the thread is correctly terminated before any
new attempt to create a new DefaultUdpTransportMapping.

Can this problem be solved in the next version of SNM4J?

SNMP4J mailing list
SNMP4J <at>
Asaf Schoen | 26 May 15:17 2015

MangedObjects locking

Hi Frank,
I implemented a SNMP Agent using your library, and wondered how can I lock the agent (block it from answer any
request) during the update period of the managed objects (each round minute).
According to the documentation, I thought that I could use the MOServer's lock function, but it doesn't
seem to work.
What am I missing?

SNMP4J mailing list
SNMP4J <at>
Carl Harris | 6 May 21:58 2015

bug report / patch info

DefaultUdpTransportMapping in Snmp4j 2.3.3 does not exit from when the transport
mapping is closed.  I scanned the snmp4j web site looking for a location to report this issue and provide a
suggested patch, but found nothing.

Is there a more appropriate place to report this issue?

SNMP4J mailing list
SNMP4J <at>
Himalaya Gupta A | 6 May 11:26 2015

DefaultTCPTransportMapping class making 100% cpu utilization


The following is the Thread Dump. I am running an application where the CPU is reaching 100% utilization due
to the SNMP4J.
Can you please let me know if you have come across such situation or what might be the issue? Thanks in advance
for your reply

SNMP4J Version : snmp4j - 1.11.3

"DefaultTCPTransportMapping_0.0.0.0/0" daemon prio=10 tid=0x5c596c00 nid=0x5431 runnable [0x5b06d000..0x5b06e030]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Throwable.fillInStackTrace(Native Method)
        - locked <0xadbd3518> (a java.util.NoSuchElementException)
        at java.lang.Throwable.<init>(
        at java.lang.Exception.<init>(Unknown Source)
        at java.lang.RuntimeException.<init>(Unknown Source)
        at java.util.NoSuchElementException.<init>(Unknown Source)
        at java.util.LinkedList.remove(Unknown Source)
        at java.util.LinkedList.removeFirst(Unknown Source)
        at org.snmp4j.transport.DefaultTcpTransportMapping$ Source)
        - locked <0x79744b88> (a java.util.LinkedList)

"DefaultTCPTransportMapping_0.0.0.0/0" daemon prio=10 tid=0x0919c400 nid=0x5235 runnable [0x5b2ff000..0x5b2fffb0]
   java.lang.Thread.State: RUNNABLE
        at Method)
        at Source)
        at Source)
        at Source)
        - locked <0x798ce4b8> (a$1)
        - locked <0x798ce4a8> (a java.util.Collections$UnmodifiableSet)
(Continue reading)

joe.sulewski | 30 Apr 15:28 2015

TcpAddress issue


I'm trying to send data over TCP due to some parts of our network that have high unreliability.  I'm using
version 2.2.3 of the SNMP4J library and I'm getting an error trying to send over tcp.

I setup the TransportMapping like so:
TcpAddress address = new TcpAddress(Inet4Address.getByName(NetTools.getLocalIPAddress()),1161);
transport = new DefaultTcpTransportMapping(address);

snmp = new Snmp(transport);

To send data I perform the following:
targetAddress = GenericAddress.parse("TCP:" + snmpSettings.getAddress() + "/" + snmpSettings.getSNMPPort());

target = new CommunityTarget();
target.setCommunity(new OctetString(snmpSettings.getCommunity()));

snmp.get(pdu, target);

The get throws the following error: Unsupported address class (transport mapping): org.snmp4j.smi.TcpAddress

When I run in the debugger I looked at the snmp variable and the
snmp->messageDispatcher->transportMappings table is:
(Continue reading)