Skip to main content

SnmpTooBigException

com.sun.jmx.snmp.SnmpTooBigException

SnmpTooBigException is described in the javadoc comments as:

Is used internally to signal that the size of a PDU exceeds the packet size limitation.

You will not usually need to use this class, except if you decide to implement your own {link: com.sun.jmx.snmp.SnmpPduFactory SnmPduFactory} object.

The varBindCount property contains the number of SnmpVarBind successfully encoded before the exception was thrown. Its value is 0 when this number is unknown.

This API is a Sun Microsystems internal API and is subject to change without notice.


version: 1.1 07/23/98 author: Sun Microsystems, Inc

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

com.sun.jmx.snmp.SnmpMessage.encodeMessage(byte[])

/**
     * Encodes this message and puts the result in the specified byte array.
     * For internal use only.
     * @param outputBytes An array to receive the resulting encoding.
     * @exception ArrayIndexOutOfBoundsException If the result does not fit
     *                                           into the specified array.
     */
public int encodeMessage(byte[] outputBytes) throws SnmpTooBigException {
    int encodingLength = 0;
    if (data == null) throw new IllegalArgumentException('Data field is null');
    try {
        BerEncoder benc = new BerEncoder(outputBytes);
        benc.openSequence();
        benc.putAny(data, dataLength);
        benc.putOctetString((community != null) ? community : new byte[0]);
        benc.putInteger(version);
        benc.closeSequence();
        encodingLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
    return encodingLength;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.snmp.SnmpMessage.encodeSnmpPdu(SnmpPdu, int)

/**
     * Initializes this message with the specified <CODE>pdu</CODE>.
     * <P>
     * This method initializes the data field with an array of 
     * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. 
     * The resulting encoding is stored in the data field
     * and the length of the encoding is stored in <CODE>dataLength</CODE>.
     * If the encoding length exceeds <CODE>maxDataLength</CODE>, 
     * the method throws an exception.
     * @param pdu The PDU to be encoded.
     * @param maxDataLength The maximum length permitted for the data field.
     * @exception SnmpStatusException If the specified <CODE>pdu</CODE> is not valid.
     * @exception SnmpTooBigException If the resulting encoding does not fit
     * into <CODE>maxDataLength</CODE> bytes.
     * @exception ArrayIndexOutOfBoundsException If the encoding exceeds <CODE>maxDataLength</CODE>.
     * @since 1.5
     */
public void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength) throws SnmpStatusException, SnmpTooBigException {
    SnmpPduPacket pdupacket = (SnmpPduPacket) pdu;
    version = pdupacket.version;
    community = pdupacket.community;
    address = pdupacket.address;
    port = pdupacket.port;
    data = new byte[maxDataLength];
    try {
        BerEncoder benc = new BerEncoder(data);
        benc.openSequence();
        encodeVarBindList(benc, pdupacket.varBindList);
        switch(pdupacket.type) {
            case pduGetRequestPdu:
            case pduGetNextRequestPdu:
            case pduInformRequestPdu:
            case pduGetResponsePdu:
            case pduSetRequestPdu:
            case pduV2TrapPdu:
            case pduReportPdu:
                SnmpPduRequest reqPdu = (SnmpPduRequest) pdupacket;
                benc.putInteger(reqPdu.errorIndex);
                benc.putInteger(reqPdu.errorStatus);
                benc.putInteger(reqPdu.requestId);
                break;
            case pduGetBulkRequestPdu:
                SnmpPduBulk bulkPdu = (SnmpPduBulk) pdupacket;
                benc.putInteger(bulkPdu.maxRepetitions);
                benc.putInteger(bulkPdu.nonRepeaters);
                benc.putInteger(bulkPdu.requestId);
                break;
            case pduV1TrapPdu:
                SnmpPduTrap trapPdu = (SnmpPduTrap) pdupacket;
                benc.putInteger(trapPdu.timeStamp, SnmpValue.TimeticksTag);
                benc.putInteger(trapPdu.specificTrap);
                benc.putInteger(trapPdu.genericTrap);
                if (trapPdu.agentAddr != null) benc.putOctetString(trapPdu.agentAddr.byteValue(), SnmpValue.IpAddressTag); else benc.putOctetString(new byte[0], SnmpValue.IpAddressTag);
                benc.putOid(trapPdu.enterprise.longValue());
                break;
            default:
                throw new SnmpStatusException('Invalid pdu type ' + String.valueOf(pdupacket.type));
        }
        benc.closeSequence(pdupacket.type);
        dataLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.snmp.SnmpV3Message.encodeSnmpPdu(SnmpPdu, int)

/**
     * Initializes this message with the specified <CODE>pdu</CODE>.
     * <P>
     * This method initializes the data field with an array of 
     * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. 
     * The resulting encoding is stored in the data field
     * and the length of the encoding is stored in <CODE>dataLength</CODE>.
     * If the encoding length exceeds <CODE>maxDataLength</CODE>, 
     * the method throws an exception.
     * @param p The PDU to be encoded.
     * @param maxDataLength The maximum length permitted for the data field.
     * @exception SnmpStatusException If the specified <CODE>pdu</CODE> 
     *   is not valid.
     * @exception SnmpTooBigException If the resulting encoding does not fit
     * into <CODE>maxDataLength</CODE> bytes.
     * @exception ArrayIndexOutOfBoundsException If the encoding exceeds 
     *    <CODE>maxDataLength</CODE>.
     */
public void encodeSnmpPdu(SnmpPdu p, int maxDataLength) throws SnmpStatusException, SnmpTooBigException {
    SnmpScopedPduPacket pdu = (SnmpScopedPduPacket) p;
    if (isTraceOn()) {
        trace('encodeSnmpPdu', 'Pdu to marshall: \n' + 'security parameters : ' + pdu.securityParameters + '\n' + 'type :' + pdu.type + '\n' + 'version :' + pdu.version + '\n' + 'requestId :' + pdu.requestId + '\n' + 'msgId :' + pdu.msgId + '\n' + 'msgMaxSize :' + pdu.msgMaxSize + '\n' + 'msgFlags :' + pdu.msgFlags + '\n' + 'msgSecurityModel :' + pdu.msgSecurityModel + '\n' + 'contextEngineId :' + pdu.contextEngineId + '\n' + 'contextName :' + pdu.contextName + '\n');
    }
    version = pdu.version;
    address = pdu.address;
    port = pdu.port;
    msgId = pdu.msgId;
    msgMaxSize = pdu.msgMaxSize;
    msgFlags = pdu.msgFlags;
    msgSecurityModel = pdu.msgSecurityModel;
    contextEngineId = pdu.contextEngineId;
    contextName = pdu.contextName;
    securityParameters = pdu.securityParameters;
    data = new byte[maxDataLength];
    try {
        BerEncoder benc = new BerEncoder(data);
        benc.openSequence();
        encodeVarBindList(benc, pdu.varBindList);
        switch(pdu.type) {
            case pduGetRequestPdu:
            case pduGetNextRequestPdu:
            case pduInformRequestPdu:
            case pduGetResponsePdu:
            case pduSetRequestPdu:
            case pduV2TrapPdu:
            case pduReportPdu:
                SnmpPduRequestType reqPdu = (SnmpPduRequestType) pdu;
                benc.putInteger(reqPdu.getErrorIndex());
                benc.putInteger(reqPdu.getErrorStatus());
                benc.putInteger(pdu.requestId);
                break;
            case pduGetBulkRequestPdu:
                SnmpPduBulkType bulkPdu = (SnmpPduBulkType) pdu;
                benc.putInteger(bulkPdu.getMaxRepetitions());
                benc.putInteger(bulkPdu.getNonRepeaters());
                benc.putInteger(pdu.requestId);
                break;
            default:
                throw new SnmpStatusException('Invalid pdu type ' + String.valueOf(pdu.type));
        }
        benc.closeSequence(pdu.type);
        dataLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.snmp.SnmpMsg.encodeVarBindList(BerEncoder, SnmpVarBind[])

/**
     * For SNMP Runtime private use only.
     */
public void encodeVarBindList(BerEncoder benc, SnmpVarBind[] varBindList) throws SnmpStatusException, SnmpTooBigException {
    int encodedVarBindCount = 0;
    try {
        benc.openSequence();
        if (varBindList != null) {
            for (int i = varBindList.length - 1; i >= 0; i--) {
                SnmpVarBind bind = varBindList[i];
                if (bind != null) {
                    benc.openSequence();
                    encodeVarBindValue(benc, bind.value);
                    benc.putOid(bind.oid.longValue());
                    benc.closeSequence();
                    encodedVarBindCount++;
                }
            }
        }
        benc.closeSequence();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException(encodedVarBindCount);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.jmx.snmp.daemon.SnmpRequestHandler.reduceResponsePdu(SnmpPduPacket, SnmpPduPacket, int)

private SnmpPduPacket reduceResponsePdu(SnmpPduPacket req, SnmpPduPacket resp, int acceptedVbCount) throws SnmpTooBigException {
    if (req.type != req.pduGetBulkRequestPdu) {
        if (isDebugOn()) {
            debug('reduceResponsePdu', 'cannot remove anything');
        }
        throw new SnmpTooBigException(acceptedVbCount);
    }
    int vbCount = resp.varBindList.length;
    if (acceptedVbCount >= 3) vbCount = Math.min(acceptedVbCount - 1, resp.varBindList.length); else if (acceptedVbCount == 1) vbCount = 1; else vbCount = resp.varBindList.length / 2;
    if (vbCount < 1) {
        if (isDebugOn()) {
            debug('reduceResponsePdu', 'cannot remove anything');
        }
        throw new SnmpTooBigException(acceptedVbCount);
    } else {
        SnmpVarBind[] newVbList = new SnmpVarBind[vbCount];
        for (int i = 0; i < vbCount; i++) {
            newVbList[i] = resp.varBindList[i];
        }
        if (isDebugOn()) {
            debug('reduceResponsePdu', (resp.varBindList.length - newVbList.length) + ' items have been removed');
        }
        resp.varBindList = newVbList;
    }
    return resp;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Comments

Popular posts from this blog

BAD_CERTIFICATE - A corrupt or unuseable certificate...

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom
In wls_utc, when trying to test a webservice using SSL, the following error message is received: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
If SSL debugging is enabled, the following error also appears in the logs: ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' <1254822672320>>
verification failed because RSA key public exponent [3] is too small
Cause
The certificate encryption is of a weaker strength than expected by newer versions of Java.
Solution
Add the flag "-Dweblogic.security.SSL.allowSmallRSAExponent=true" to the server startup parameters.
References


None.

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom

The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times.
java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277)
Cause
This message (Connection refused: connect; No available router to destination) is a kind of "catch…

BEASVC.EXE - WebLogic as a Windows Service

I remember the first time I had to work out why WebLogic wouldn't run as a service. It was a frustrating experience. There were no error messages. No Windows error dialog. No console output.

How do you troubleshoot something like this??!!

This short article will show you. For simplicity I'll talk about the node manager, but the same principles apply for running an admin or managed server as a service.

First Steps

First, you still have your server logs. Sure the console output is better, but it's a starting point. Check this log for errors and especially take note of the start up variables such as PATH and CLASSPATH. If the server log isn't being created, that tells you WebLogic probably isn't even being started. (Check that you have a license file if you haven't already.)

Ok, so the logs were no help. The next step is to look at how the service is trying to start WebLogic.

When you install WebLogic as a service, you're really setting up beasvc.exe as the service.…