当前位置:编程学习 > JAVA >>

java解析mib文件报错:net.percederberg.mibble.MibLoaderException: found 1 MIB loader err


跪求大神啊 
错误:
Exception in thread "main" net.percederberg.mibble.MibLoaderException: found 1 MIB loader errors
at net.percederberg.mibble.MibLoader.load(Unknown Source)
at net.percederberg.mibble.MibLoader.load(Unknown Source)

代码:

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import net.percederberg.mibble.Mib;
import net.percederberg.mibble.MibLoader;
import net.percederberg.mibble.MibLoaderException;
import net.percederberg.mibble.MibValue;
import net.percederberg.mibble.MibValueSymbol;
import net.percederberg.mibble.snmp.SnmpObjectType;
public class newtest {
private static List<MibObject> list = new ArrayList<MibObject>();
    /**
     * @param args
     * @throws MibLoaderException
     * @throws IOException
     * @throws SQLException 
     */
    public static void main(String[] args) throws IOException, MibLoaderException, SQLException {
    newtest t = new newtest();
        t.aa();

    }
    @SuppressWarnings( { "unchecked" })
    public void aa() throws IOException, MibLoaderException {
//        String filePath = this.getClass().getResource("/").getPath() + "UCD-SNMP-MIB.txt";
     String filePath = this.getClass().getResource("/").getPath() + "HUAWEI-AAA-MIB.mib";
        File file = new File(filePath);
        MibLoader ml = new MibLoader();
        Mib mib = ml.load(file);
        String mibName = mib.getName();
        String syntax = "";
        String access = "";
        String status = "";
        Collection c = mib.getAllSymbols();
        Iterator it = c.iterator();
        while (it.hasNext()) {
            Object obj = it.next();
            if (obj instanceof MibValueSymbol) {
                MibObject mo = new MibObject();
                MibValueSymbol mvs = (MibValueSymbol) obj;
                SnmpObjectType sot = null;
                if (mvs.getType() instanceof SnmpObjectType) {
                    sot = (SnmpObjectType) mvs.getType();
                }
                if (sot != null ) {
                    syntax = sot.getSyntax().getName();
                    access = sot.getAccess().toString();
                    status = sot.getStatus().toString();
                }
                boolean isTableColumn = mvs.isTableColumn();
                String name = mvs.getName();
                MibValue value = mvs.getValue();
                MibValueSymbol parent = mvs.getParent();
                String parentValue = "";
                System.err.println("name==" + name);
                System.err.println("value==" + value);
                System.err.println("isTableColumn==" + isTableColumn);
          
            } 
           
        }

    }

} java  mib   解析 --------------------编程问答-------------------- 没有大神吗。。。。。
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,