2 Replies Latest reply on Jan 12, 2009 2:14 AM by jaikiran pai

    method overloading issue in 4.2.2 ? Wrong target message. Wh

    J Boss Newbie

      I am trying to create a MBean and test in the JMX console.

      It deploys fine and shows up in the JMX console,
      but as soon as I call the method with no argument and later tries to call the method with an argument it fails with a "wrong target" error message.

      Is it a known issue or am I doing something wrong here?

      It works fine if I rename one of the methods so there is no overloading...

      I'm using 4.2.2.GA and JDK1.5.0_14

      Here is test code that will break once jared up and deployed(2 files):

      //Test.java
      package test;

      public interface Test {
      public String aMethod(String aString);
      public String aMethod();
      }


      //TestMBean.java
      package test;

      import org.jboss.annotation.ejb.Management;
      import org.jboss.annotation.ejb.Service;


      @Service(objectName="A:service=test")
      @Management(Test.class)
      public class TestMBean implements Test{

      public String aMethod(String string) {
      return "Test with arg " +string;
      }

      public String aMethod() {
      return "Test with no arg";
      }
      }

        • 1. Re: method overloading issue in 4.2.2 ? Wrong target message
          J Boss Newbie

          Stack trace from JMX console:
          HTTP Status 500 -

          type Exception report

          message

          description The server encountered an internal error () that prevented it from fulfilling this request.

          exception

          javax.servlet.ServletException: Failed to invoke operation
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:269)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          root cause

          javax.management.MBeanException
          org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:219)
          org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
          org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
          org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          root cause

          javax.ejb.EJBException: java.lang.IllegalArgumentException: Wrong target. class test.TestMBean for public java.lang.String test.TestMBean.aMethod()
          org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
          org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
          org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
          org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:329)
          org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:294)
          org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:215)
          org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
          org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
          org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          root cause

          java.lang.IllegalArgumentException: Wrong target. class test.TestMBean for public java.lang.String test.TestMBean.aMethod()
          org.jboss.aop.joinpoint.MethodInvocation.handleErrors(MethodInvocation.java:141)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:116)
          org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
          org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
          org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
          org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:329)
          org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:294)
          org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:215)
          org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
          org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
          org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
          org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96