好吧,那么。我已经部署了一个通过spring的MBeanExporter和注释公开的MBean。我已经部署了另一个war应用程序,它使用一些代码与mbean对话。我在从客户端代码调用mbean上的函数时遇到问题。
尝试调用操作getPermissions时,RequiredModelMBean中出现运行时异常。
mbean方法的签名是Collection getPermissions(GrantedAuthority角色)。
我用来称呼它的代码是
Object[] params = {role}; //role is passed in as a GrantedAuthorityImpl (implements GrantedAuthority)
String[] signature = {"org.springframework.security.core.authority.GrantedAuthority"};
mbeanServer.invoke(new ObjectName(mbeanName), "getPermissions", params, signature);
javax.management.RuntimeOperationsException: RuntimeException occurred in RequiredModelMBean while trying to invoke operation getPermissions
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1080)
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955)
org.springframework.jmx.export.SpringModelMBean.invoke(SpringModelMBean.java:90)
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
org.jboss.mx.modelmbean.RequiredModelMBeanInvoker.invoke(RequiredModelMBeanInvoker.java:127)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
xxx.MBeanPermissionMapLookup.getPermissions(MBeanPermissionMapLookup.java:31)
xxx.MBeanPermissionMapLookup$$FastClassByCGLIB$$667f3fad.invoke(<generated>) ...
root cause: java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244)
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1074)
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955)
org.springframework.jmx.export.SpringModelMBean.invoke(SpringModelMBean.java:90)
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
org.jboss.mx.modelmbean.RequiredModelMBeanInvoker.invoke(RequiredModelMBeanInvoker.java:127)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
xxx.MBeanPermissionMapLookup.getPermissions(MBeanPermissionMapLookup.java:31)
使用Spring 3.0.4、springsecurity3.0.3、jboss 5.1.0、java jdk 1.6.0-17。