猿问

java.lang.IllegalArgumentException: argument type mismatch

哪里有错啊 ,GetMapProperty gp = new GetMapProperty();里面的getter,setter方法大小写没问题,有时候还会在报  method not found:isButton   错误。求大神告知一下吧,

try {

GetMapProperty gp = new GetMapProperty();

System.out.println("之前 : "+ gp);

Map<String,String[]> map = request.getParameterMap();

for (Entry<String, String[]> m : map.entrySet()) {

String name = m.getKey();

String [] values = m.getValue();

PropertyDescriptor pdp = new PropertyDescriptor(name, GetMapProperty.class);

Method w = pdp.getWriteMethod();

if(values.length==1){

w.invoke(gp, values[0]);

}else{

w.invoke(gp, (Object)values);

}

}

System.out.println("之后 : "+ gp);

} catch (Exception e) {

e.printStackTrace();

}

错误 :

java.lang.IllegalArgumentException: argument type mismatch

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.GetMap.doGet(GetMap.java:32)

at com.GetMap.doPost(GetMap.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:744)


宿萌
浏览 1545回答 1
1回答
随时随地看视频慕课网APP

相关分类

Java
我要回答