zoukankan      html  css  js  c++  java
  • 我在使用BeanUtil工具包时,用populate()方法时总报异常

    我在使用BeanUtil工具包时,用populate()方法时总报如下异常,看后面引起的原因Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at cn.xx.page.web.servlet.BaseServlet.doGet(BaseServlet.java:25)
    at cn.xx.page.web.servlet.BaseServlet.doPost(BaseServlet.java:44)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap
    at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:963)
    at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:935)
    at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:823)
    at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:431)
    at cn.xx.page.web.servlet.UserServlet.login(UserServlet.java:31)
    ... 30 more
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.FastHashMap
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)
    ... 35 more

     原因,一般在导包时,只导了jar包:commons-beanutils-1.9.3.jar和commons-logging-1.2.jar两个,而这里是说commons.collections这个包没有,所以

    然后导入了commens-collections4-4.1.jar发现并没有解决问题

    最后,发现导入commens-collections-3.2.2.jar后解决问题了

  • 相关阅读:
    日志记录
    python进程基础
    堆和栈的区别
    Mysql数据类型(一)
    JS超链接动态显示图片
    WPF Button控件模板
    js table鼠标点击时变色
    JS表格各行变色
    js动态创建表格
    Codeforces 659G Fence Divercity dp
  • 原文地址:https://www.cnblogs.com/xiaoxionganna/p/9182400.html
Copyright © 2011-2022 走看看