Announcement Announcement Module
No announcement yet.
How to solve InvalidInvocationException Exception? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to solve InvalidInvocationException Exception?

    Firstly, Post my spring config xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">


    <bean id="serverConnector" depends-on="registry"
    class=" rverFactoryBean">
    <property name="objectName" value="connector:name=rmi" />
    <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:9875/123456" />

    <bean id="registry"
    class="org.springframework.remoting.rmi.RmiRegistr yFactoryBean">
    <property name="port" value="9875" />

    <bean id="mbeanserver" class=" FactoryBean">
    <!-- property name="defaultDomain" value="JMI:type=MBean1111111111Server" /-->
    <!-- indicate to first look for a server -->
    <property name="locateExistingServerIfPossible" value="false"/>
    <!-- property name="agentId" value="MBeanTest"/-->

    <bean id="jmxMBeanExport" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="server" ref="mbeanserver" />

    <property name="beans">
    <entry key="bean:name=boy">
    <bean class="com.ebupt.jmxTest.boy">

    <entry key="bean:name=dog">
    <bean class="" />

    <property name="assembler">
    class="org.springframework.jmx.export.assembler.In terfaceBasedMBeanInfoAssembler">
    <property name="interfaceMappings">
    <prop key="bean:name=boy">

    <prop key="bean:name=dog">



    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">

    <bean id="clientConnector"
    class=" ConnectionFactoryBean">
    <property name="serviceUrl"
    value="service:jmx:rmi:///jndi/rmi://localhost:9875/123456" />

    <bean id="proxy"
    class="org.springframework.jmx.access.MBeanProxyFa ctoryBean">
    <property name="objectName" value="bean:name=boy"/>
    <property name="server">
    <ref local="clientConnector"/>
    <property name="proxyInterface" value="com.ebupt.jmxTest.Man"/>

    As I know, In bean mbeanserver there is a property named locateExistingServerIfPossible that indicates whether to first look for a server and its default value is false.
    currntly, when locateExistingServerIfPossible is set to false, JVM will throw InvalidInvocationException.
    Exception in thread "main" org.springframework.jmx.access.InvalidInvocationEx ception: bean:name=boy
    at org.springframework.jmx.access.MBeanClientIntercep tor.invoke(
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed( :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(
    at $Proxy0.sayHello(Unknown Source)
    at com.ebupt.jmxTest.Client.main(

    conversely, JVM runs smoothly if locateExistingServerIfPossible is set to true.
    I don't know the reason why JVM throws InvalidInvocationException if locateExistingServerIfPossible is set to false and it runns well if true. and How to solve this problem if I set locateExistingServerIfPossible to false.
    Thx. source is found in enclosure

  • #2
    Proxy on Interface

    The framework can not find by reflection a means to invoke an ObjectInstance from your mbean perhaps after checking to see if the class is abstract or interface, this exception is thrown.

    So for example I resolved this by passing in interfaces (mbean.class)
    return (T) MBeanServerInvocationHandler.newProxyInstance(connection, objectName, mbean, true);
    I hope that helps