[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: java.lang.NoSuchMethodException: org.jboss.resource.adap

jaikiran do-not-reply at jboss.com
Sat Mar 15 06:54:32 EDT 2008


anonymous wrote : java.lang.NoSuchMethodException: org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeBatch() 


private Object executeVerboseQuery(String methodName, Class[] parameters)
  | 		throws
  | 			SQLException,
  | 			NoSuchMethodException,
  | 			InvocationTargetException,
  | 			IllegalAccessException {
  | 		//determine which method we have
  | 		Method m = ps.getClass().getDeclaredMethod(methodName, parameters);
  | 
  | 

The executeBatch method is available on the org.jboss.resource.adapter.jdbc.WrappedStatement which is a superclass of org.jboss.resource.adapter.jdbc.WrappedPreparedStatement. Your are calling getDeclaredMethod("executeBatch",null) on WrappedPreparedStatement and hence getting the NoSuchMethodException. The getDeclaredMethod method does not look for the method in the superclass(es). Instead use getMethod:

Method m = ps.getClass().getMethod(methodName, parameters);

See the javadoc of these methods to understand their difference http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Class.html


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136886#4136886

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136886



More information about the jboss-user mailing list