Hi I am receiving the above error when I run my code. I am having trouble understanding what is causing the error. I have seen the solution on a similar thread but I am not sure if this applies in my case. Can someone please help me make some sense of this? Any help is greatly appreciated.
ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/window].[jsp]]
Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: object is not an instance of
declaring class at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
com.container.taglib.util.MirrorMaker.invokeMethod(MirrorMaker.java:54)
at
com.container.taglib.util.MirrorMaker.invokeMethod(MirrorMaker.java:48)
at
com.container.taglib.list.TableSorter.invokeMethod(TableSorter.java:1092)
at
com.container.taglib.list.TableSorter.createList(TableSorter.java:503)
at
com.container.taglib.list.TableSorter.doAfterBody(TableSorter.java:151)
Code:
public static Object invokeMethod(Object obj, Method method, Object[] params)throws IllegalAccessException, InvocationTargetException{
Object ret = null;
String str = "";
try{
ret = method.invoke(obj, params);
if(ret instanceof String){
str = (String)ret;
//logger.info("ret str: "+str);
}else if(ret instanceof Integer){
str = ((Integer)ret).toString();
//logger.info("ret int: "+str);
}else if(ret instanceof java.util.Date){
str = new SimpleDateFormat("yyyy-MM-dd").format(ret);
logger.info("ret date: "+str);
}else if(ret instanceof Double) {
str = ((Double)ret).toString();
}else if(ret instanceof ArrayList){
return ret;
}else{
return ret;
}
}catch(IllegalAccessException ex){
logger.info("illegal access");
throw ex;
}catch(InvocationTargetException ex){
logger.error("invocation target ex");
throw ex;
}
return str;
}