当前位置: 代码迷 >> Eclipse >> 请问一下, 为什么我在用 PropertyUtils.getPropertyType 的时候会出现java.lang.NoClassDefFoundError 的错误? 多谢!
  详细解决方案

请问一下, 为什么我在用 PropertyUtils.getPropertyType 的时候会出现java.lang.NoClassDefFoundError 的错误? 多谢!

热度:56   发布时间:2016-04-23 14:31:04.0
请教一下各位高手, 为什么我在用 PropertyUtils.getPropertyType 的时候会出现java.lang.NoClassDefFoundError 的错误? 谢谢!!!
请教一下各位高手,   为什么我在用   PropertyUtils.getPropertyType   的时候会出现java.lang.NoClassDefFoundError   的错误?   谢谢!!!

import   java.lang.reflect.InvocationTargetException;
import   java.util.ArrayList;
import   org.apache.commons.beanutils.PropertyUtils;

public   class   Test   {

public   static   void   main(String[]   args)
{
Chapter   chapter   =   new   Chapter();
        //   下面将出个这个name属性的类型,String
     
      chapter.setName( "xxxxxxxxxx ");

        ArrayList   chapters   =   new   ArrayList();
        chapters.add(chapter);
               
        Book   book2   =   new   Book();
        book2.setChapters(chapters);
               
        Class   type2   =   null   ;
       
        System.out.println( "here ");
try   {
type2   =   PropertyUtils.getPropertyType(book2,   "chapters[0].name ");
}   catch   (IllegalAccessException   e)   {
//   TODO   Auto-generated   catch   block
e.printStackTrace();
}   catch   (InvocationTargetException   e)   {
//   TODO   Auto-generated   catch   block
e.printStackTrace();
}   catch   (NoSuchMethodException   e)   {
//   TODO   Auto-generated   catch   block
e.printStackTrace();
}
 
       
System.out.println(type2.getName());
}
}


输出的显示是:
here
Exception   in   thread   "main "   java.lang.NoClassDefFoundError:   org/apache/commons/collections/FastHashMap
at   org.apache.commons.beanutils.PropertyUtils. <clinit> (PropertyUtils.java:208)
at   Test.main(Test.java:30)

------解决方案--------------------
顶,,,,,,,我也想知道..
  相关解决方案