我用这种方法直接写一个普通类直接运行,调用完全正常。但放在JSP中调用总是出现NoSuchMethodException.
代码如下:
EJBClient cxObj = EJBClient.getInstance();
String resultStr = cxObj.call("KYDJ", "Cx", new String[] {tj, "KYDJ", "0", "19"});
public String call(String jndiName, String methodName, Object[] args) {
String returnValue = null;
Class[] argTypes = null;
Object proxy = createProxy(jndiName);
if (args != null) {
argTypes = new Class[args.length];
for (int i = 0; i < args.length; i++) {
argTypes = args.getClass();
}
try {
returnValue = (String) (proxy.getClass().getDeclaredMethod(methodName,
argTypes).invoke(proxy, args));//此处在JSP中出错
}
catch (java.lang.NoSuchMethodException nsme) {
....
虚心求教.