2015-10-30 18 views
0

我目前正在使用SNMP4J API构建一个使用Java构建SNMP代理和管理器的项目。SNMP4J:“使用的不一致命名”错误是什么意思?

我创建了一个MOTable 3列,然后尝试从客户端发送一组在MOTable概念表中创建一个新的行。

以下是所添加变量绑定到PDU我的客户端代码中的提取物,然后发送SNMP设置为代理:

final static OID[] customTable = new OID[]{new OID(".1.3.6.1.2.1.3.1"), 
              new OID(".1.3.6.1.2.1.3.2"), 
              new OID(".1.3.6.1.2.1.3.3")}; 
PDU customTablePDU = new PDU(); 
customTablePDU.addAll(new VariableBinding[]{new VariableBinding(customTable[0],new OctetString("192.168.1.12")), 
      new VariableBinding(customTable[1],new Integer32(0)), 
      new VariableBinding(customTable[2],new Integer32(100))}); 
ResponseEvent customTableResponse = customSnmp.set(customTablePDU, comtarget); 

的“.1.3.6.1.2.1.3.x”其中x = 1,2或3分别是我表中第1,2和3列的OID,分别包含OctetString,Integer32和第二个Integer32。

不幸的是,我得到以下错误,当我运行客户端:

你知道这是什么意思的错误,以及如何解决它,以创建一个行?

java.lang.Exception的:在org.snmp4j.agent.request.SnmpRequest $ SnmpSubRequest.requestStatusChanged(SnmpRequest 1.3.6.1.2.1.3.1 = 192.168.1.12:在产生错误 '用于命名不一致'。的java:621) 在 org.snmp4j.agent.request.RequestStatus.fireRequestStatusChanged(RequestStatus.java:89) 在 org.snmp4j.agent.request.RequestStatus.setErrorStatus(RequestStatus.java:52) 在 有机.snmp4j.agent.mo.DefaultMOTable.prepare(DefaultMOTable.java:601) 在 org.snmp4j.agent.CommandProcessor $ SetHandler.prepare(CommandProcessor.java:830) 在 org.snmp4j.agent.CommandProcessor $ SetHandler.processPdu(CommandProcessor.java:863) 在 org.snmp4j.agent.CommandProcessor $ SetHandler.processPdu(CommandProcessor.java:780) 在 org.snmp4j.agent .CommandProcessor.processRequest(CommandProcessor.java:422) 在 org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java:384) 在 org.snmp4j.agent.CommandProcessor.dispatchCommand(CommandProcessor.java:340) 在 org.snmp4j.agent.CommandProcessor $ Command.run(CommandProcessor.java:560) 在 org.snmp4j.agent.CommandProcessor.processPdu(CommandProcessor.ja VA:163) 在 org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.java:675) 在 org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:302) 在 org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl的.java:373) 在 org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:333) 在 org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:76) 在 org.snmp4j.transport。 DefaultUdpTransportMapping $ ListenThread.run(DefaultUdpTransportMapping.java:423) 在java.lang.Thread.run(Threa d.java:745)

回答

0

这意味着指定的对象不存在。您必须检查PDU中的错误索引以找出哪个变量(SNMP varbind)导致了问题。