Results 1 to 5 of 5

Thread: InvocationFailureException when invoking MBean using MBeanProxyFactoryBean

  1. #1
    Join Date
    May 2009
    Posts
    11

    Default InvocationFailureException when invoking MBean using MBeanProxyFactoryBean

    Hi all,

    I'm trying to access an MBean in JBoss (same VM) using the Spring JMX proxy MBeanProxyFactoryBean. Initially I was getting my data directly from the MBean method which was working fine. To clean up the client access I refactored the MBean to make it return another bean which groups the methods I use to get my data.

    My problem is that its not liking the bean instance coming back from the MBean invocation compared to the proxyInterface i told it about:
    Code:
    2010-01-09 19:04:03,828 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test].[SpringDispatcherServlet]] (http-127.0.0.1-8080-1) Servlet.service() for servlet SpringDispatcherServlet threw exception
    org.springframework.jmx.access.InvocationFailureException: Incompatible result value [test.jmx.TestContextImpl@b6f61c] for target type [test.jmx.TestContextImpl]
    	at org.springframework.jmx.access.MBeanClientInterceptor.convertResultValueIfNecessary(MBeanClientInterceptor.java:545)
    	at org.springframework.jmx.access.MBeanClientInterceptor.doInvoke(MBeanClientInterceptor.java:411)
    	at org.springframework.jmx.access.MBeanClientInterceptor.invoke(MBeanClientInterceptor.java:348)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy311.getTestContext(Unknown Source)
    	at test.web.TestContextProxy.fireEvent(TestContextProxy.java:25)
    	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 org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
    	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
    	at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
    	at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
    	at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
    	at org.springframework.binding.expression.el.BindingValueExpression.getValue(BindingValueExpression.java:54)
    	at org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:54)
    	at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
    	at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
    	at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
    	at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
    	at org.springframework.webflow.engine.support.ActionTransitionCriteria.test(ActionTransitionCriteria.java:82)
    	at org.springframework.webflow.engine.support.TransitionCriteriaChain.test(TransitionCriteriaChain.java:71)
    	at org.springframework.webflow.engine.Transition.canExecute(Transition.java:195)
    	at org.springframework.webflow.engine.Transition.execute(Transition.java:211)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:391)
    	at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
    	at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
    	at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:386)
    	at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
    	at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:230)
    	at org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
    	at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
    	at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:163)
    	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
    	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
    	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Thread.java:619)
    I'm not sure I completely understand what is wrong there. Is it because its getting an object reference rather that the object itself?

    I can change it back to how it was before but it was a bit messy and I'd prefer to do it this way. Can anyone advise me if this is do-able and if so, where am I going wrong?

    I'm using Spring 3.0.0.RELEASE.

    Thanks in advance,
    Brad.
    Last edited by brad_uk; Jan 9th, 2010 at 01:17 PM.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Please use [ code][/code ] tags when posting code/xml/stacktraces that way they are more readable!!!

    Can you post the full stacktrace, you only posted part of it.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    May 2009
    Posts
    11

    Default

    Hi Marten,

    original post edited as requested.

    To give further context, the code is called in a proxy class which is invoked from en EL expression in WebFlow. The invoking code in the local class looks like this:

    Code:
    		//get the proxy object from MBean
                    TestContext ctx = this.mbean.getTestContext(CLIENT_NAME);
                    //invoke method on proxy
    		ctx.fireEvent(eventOriginator, subComponent, eventName, eventValue, id);
    Hope that helps.

  4. #4
    Join Date
    May 2009
    Posts
    11

    Default

    I should probably mention that the object I'm getting from the MBean isn't just an aggregation of data, it references other beans which perform application logic and database access.

    I'm guessing this is the cause, i.e. it would work if it was a Serializable data aggregation but not as a fully resourced application component?
    Last edited by brad_uk; Jan 10th, 2010 at 07:25 AM.

  5. #5
    Join Date
    Feb 2009
    Posts
    1

    Default

    Hi,

    I'm getting the same type of error trying to access a remote MBean (Runtime) invoking List<String> getInputArguments().

    Spring config:

    Code:
    <bean id="portalClientConnector"
          class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
    	  <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myconnector"/>
    </bean>
    
    <bean id="portalRunTimeProxy" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
    	  <property name="objectName" value="java.lang:type=Runtime"/>
    	  <property name="proxyInterface" value="java.lang.management.RuntimeMXBean"/>
    	  <property name="server" ref="portalClientConnector"/>
    </bean>
    Running the following:

    Code:
    for (String s : portalRunTimeProxy.getInputArguments()) {
    	System.out.println(s);
    }
    Yeilds:
    Code:
    VARNING: Incompatible result value [[Ljava.lang.String;@845058] for target type [java.util.List]
    org.springframework.jmx.access.InvocationFailureException: Incompatible result value [[Ljava.lang.String;@845058] for target type [java.util.List]
    	at org.springframework.jmx.access.MBeanClientInterceptor.convertResultValueIfNecessary(MBeanClientInterceptor.java:545)
    	at org.springframework.jmx.access.MBeanClientInterceptor.doInvoke(MBeanClientInterceptor.java:411)
    	at org.springframework.jmx.access.MBeanClientInterceptor.invoke(MBeanClientInterceptor.java:348)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy68.getInputArguments(Unknown Source)
    	at com.tdc.tdcserviceonline.web.admin.controller.portal.PortalStatusController.doGet(PortalStatusController.java:108)
    	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 org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    	at com.tdc.web.servlet.WebDispatcherServlet.doService(WebDispatcherServlet.java:46)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:530)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1216)
    	at com.tdc.web.servlet.HeaderFilter.doFilter(HeaderFilter.java:34)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:344)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:110)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:98)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:95)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:425)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494)
    	at org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182)
    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:933)
    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362)
    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
    	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
    	at org.eclipse.jetty.server.Server.handle(Server.java:334)
    	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559)
    	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:992)
    	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:541)
    	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:203)
    	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406)
    	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
    	at java.lang.Thread.run(Thread.java:619)
    It seems that MBeanClientInterceptor.convertResultValueIfNecessa ry doesn't understand convert the result.

    Has anyone seen this, any ideas for a fix?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •