NestableRuntimeException报错解决

  • Post author:
  • Post category:其他


一、报错问题

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at com.test.test.TTTT.main(TTTT.java:9)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

… 13 more

二、代码分析

package com.test.test;

import java.util.Iterator;

import net.sf.json.JSONObject;

public class TTTT {
	public static void main(String[] args) {
			JSONObject bandwidth = new JSONObject();
			JSONObject data = new JSONObject();
			data.put("in", "88");
			data.put("out", "99");
			bandwidth.put("vnic00375", data);
			bandwidth.put("vnic00376", data);
			bandwidth.put("vnic00377", data);
			Iterator it = bandwidth.keys();  
			JSONObject bandwidth2 = new JSONObject();
			 int i=1;
			while(it.hasNext()) {  
				 String key = (String) it.next();  
				 String value = bandwidth.getString(key);  
				 key="内网网卡"+i;
				 bandwidth2.put(key, value);
				 i++;
			}
			System.out.println(bandwidth2);
	}
}

三、解决方案

四、运行结果



版权声明:本文为liuyishan1993原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。