FAQs - RMI API

  1. RMI applications with JDK 1.2 throw SecurityException. How do I avoid this?

  2. Our product currently uses the com.adventnet.snmp.rmi package, the SnmpTarget, and the snmpGet method for data retrieval. Can I combine multiple varbinds into a single SNMP GET message? Can I use snmpGetList or snmpGetAllList? How are they different? How do I control the size without exceeding the 484 byte SNMP payload limit when I add varbinds?

  3. RMI requests are slow in Windows NT and Windows 2000 machines. Why is this so?

  4. I always get "Request Timed Out to 10.0.14.79" and 10.0.14.79 is our simulator. However, it works fine while using snmpget in applications directory.

1. RMI applications with JDK 1.2 throw SecurityException. How do I avoid this?

 

To run rmi in JDK1.2 environment, you need to set the security permission and file permission as follows.

 

grant {

// allows anyone to listen on un-privileged ports permission

java.net.SocketPermission "localhost:161-65535", "listen,accept,connect,resolve";

 

// Assuming mibs directory is present in the c Drive.

permission java.io.FilePermission "c:\\mibs\\-","read, write";

};

 

A sample SNMPRmi.policy file is available in the rmiclient sub directory in the examples directory.

 

To run the AdventNetSNMP rmi server, give the following command from the rmiclient directory.

 

java -Djava.security.policy=SNMPRmi.policy

com.adventnet.snmp.rmi.SnmpFactoryImpl

 

Alternatively, you can use the files start_rmi_server.bat (Windows) or start_rmi_server.sh (Linux/Solaris) present in rmiclient directory.

 

Note: For granting file permissions to different directories, you may need to edit the SNMPRmi.policy and include the directory names in the policy file.

 

Questions

 

2. Our product currently uses the com.adventnet.snmp.rmi package, the SnmpTarget interface, and the snmpGet method for data retrieval. Can I combine multiple varbinds into a single SNMP GET message? Can I use snmpGetList or snmpGetAllList? How are they different? How do I control the size without exceeding the 484 byte SNMP payload limit when I add varbinds?

 

The snmpGetList method makes a get request for a list of OIDs while the snmpGetAllList walks from a particular OID. You can use the snmpGetList to combine multiple varbinds and perform a GET operation.

 

While constructing a PDU, you have to check its size. If it exceeds the limit, it has to be reconstructed by splitting the PDU. You can get the length of the PDU by using the method pdu.getEncodedLength(). However, you have to set the community on the PDU to get the right encoded length. If the length exceeds the limit, split the number of varbinds to be sent into two sets and construct two PDUs.

Questions

 

3. RMI requests are slow in Windows NT and Windows 2000 machines. Why is this so?

 

This is because, in Windows NT and Windows 2000, while making SNMP requests through RMI, the RMI Registry does a DNS lookup for the IP address specified.

 

The following workaround should solve the problem.

Questions

 

4. I always get "Request Timed Out to 10.0.14.79" and 10.0.14.79 is our simulator. However, it works fine while using snmpget in applications directory.

 

This error might occur due to the following reasons.

java.net.SocketPermission "*:161-60000", "listen,connect,accept";

 

If you do not have the entry "accept", then you might face the timeout problem. Assuming that you have permissions to listen and connect to the socket, create the SnmpTarget and send the requests. The timeout occurs if you do not have permission to accept messages through the socket. Verify the entry in your policy file.

Questions

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.