[SNMP4J] Strange problem porting console app to web

jeffrey.j.petter at verizon.com jeffrey.j.petter at verizon.com
Wed Jun 14 21:41:37 CEST 2006


Hi,

I have a very strange problem that I can't figure out for the life of me
and wondered if anyone else may have experienced the same thing.

I have a very basic console app that is based on the SNMP4J code that came
with "Essential SNMP". In this app, I have hard-coded some OID's of
interest, so all that happens when the app starts is you enter a hostname
or IP, and the values are printed to the screen. Very simple, very basic,
but it works great. Since this code was in class files, it was seemingly
easy to port it to the web. The only difference is that now the hostname is
entered into a text field and you click a button, and the returned values
should populate a text area control.

It should be a "slam-dunk" piece of cake. However, it doesn't work. I have
two machines on my desk, and spent all day stepping through each app
(console and web) at the same time, comparing all values. Everything goes
great until I hit this function:

    private static PDU get(Snmp snmp, PDU request, Target target) throws
IOException {
      request.setNonRepeaters(0);
      PDU response = null;
      int objects = 0;
      int requests = 0;

               requests++;
               ResponseEvent responseEvent = snmp.send(request, target);
               response = responseEvent.getResponse();
               if (response != null) {
                    objects += response.size();
               }

      return response;
    }

Following the call to snmp.send(request, target), on the console app the
ResponseEvent structure is fully populated including the response. However,
on the web app the response is null. As I stated, the primary class files
doing the work are 100% identical. Stepping through with the debugger, the
execution matches step for step until this point. To me, this is totally
crazy...it makes no sense. Has anyone else experienced this? Does anyone
have a clue as to what I might examine, change, tweak or whatever to get
past this barrier?

Thanks,
Jeff





More information about the SNMP4J mailing list