Announcement Announcement Module
Collapse
No announcement yet.
No such method exception while invoking an SLSB business method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No such method exception while invoking an SLSB business method

    Greetings,

    Using WebSphere 6.1 with Spring 2.5. I have the following beans wireing file:

    Code:
    <jee:local-slsb id="..." jndi-name="..." business-interface="..."/>
    Somewhere in the code I have:

    Code:
    ApplicationContext ctx = new ClassPathXmlApplicationContext ("...");
    GenericService service = ctx.getBean("...");
    System.out.println (service.sayHello ("..."));
    The call to service.sayHello() raises the following exception:

    Code:
    No such method while invoking a business method
    EJSLocalStatelessFacadeHome_651bbc32.sayHello(String)
    The EJSLocalStatelessFacadeHome_651bbc32 class is the local home interface stub generated by the WebSphere deployer at the runtime. The exception is saying that the home interface doesn't have any sayHello method. And of course it doesn't, since this is a business method.

    Using SLSB in the normal way, without relying on AbstractStatelessSessionBeanFactory works properly. I wasn't able to find any real code using AbstractStatelessSessionBeanFactory and the 2 books plus all the docs I've read, provide the full samples code but, strangelly enough, the one concerning AbstractStatelessSessionBeanFactory.

    Thinking that it might be a good reason to this miss and, as I'm not at all convinced about the advantages of using AbstractStatelessSessionBeanFactory, I'll probably go back to using the "normal way" SLSB, unless someone has a sample and wants to share it.

    Kind regards,

    Nicolas

  • #2
    Originally posted by nicolasduminil View Post
    Greetings,

    Using WebSphere 6.1 with Spring 2.5. I have the following beans wireing file:

    Code:
    <jee:local-slsb id="..." jndi-name="..." business-interface="..."/>
    Somewhere in the code I have:

    Code:
    ApplicationContext ctx = new ClassPathXmlApplicationContext ("...");
    GenericService service = ctx.getBean("...");
    System.out.println (service.sayHello ("..."));
    The call to service.sayHello() raises the following exception:

    Code:
    No such method while invoking a business method
    EJSLocalStatelessFacadeHome_651bbc32.sayHello(String)
    The EJSLocalStatelessFacadeHome_651bbc32 class is the local home interface stub generated by the WebSphere deployer at the runtime. The exception is saying that the home interface doesn't have any sayHello method. And of course it doesn't, since this is a business method.

    Using SLSB in the normal way, without relying on AbstractStatelessSessionBeanFactory works properly. I wasn't able to find any real code using AbstractStatelessSessionBeanFactory and the 2 books plus all the docs I've read, provide the full samples code but, strangelly enough, the one concerning AbstractStatelessSessionBeanFactory.

    Thinking that it might be a good reason to this miss and, as I'm not at all convinced about the advantages of using AbstractStatelessSessionBeanFactory, I'll probably go back to using the "normal way" SLSB, unless someone has a sample and wants to share it.

    Kind regards,

    Nicolas
    Hi
    I am using remote (had local but finally removed them) EJB on websphere 6.1 and Spring 2.5 and evertthing works as expected...

    If you invoke method on stub and you get NoSuchMethodException it means you have no method with that name

    Client stubs are generated on ejbObject/ejbLocalobject interfaces as it provides client view of Ejb .It implies that you must create EjbLocalObject interface that contains business methods you want to be invoked on your EJB.

    So solution to your problem is to create EJBlocalObject interface for your ejb that extends (interface extends interface) pojo interface.

    Code:
    public interface PojoInterface{
    void sayHello();
    }
    Code:
    public interface EjbInterface extends EJBLocalObject,PojoInterface{
    }
    then

    Code:
    <jee:local-slsb id="..." jndi-name="..." business-interface="PojoInterface"/>
    The code is written "by hand" so watch typos.
    I just want to present you only intention, but the code i provided above should works.

    Comment


    • #3
      Try out the newest Spring version. There has been a bug which has been fixed meanwhile.

      Regards,
      Andreas

      Comment


      • #4
        miluch said:
        If you invoke method on stub and you get NoSuchMethodException it means you have no method with that name
        You don't seem to understand the problem. For some reasons, when I'm calling my service, the home interface stub gets called, and of course there is not any method with this name in the home interface. The method is in the component interface which doesn't get callled when I'm calling my service. As far as I understood, the call to the service is supposed to cal the home interface in order to create the bean and, once the bean was created, to call on the component interrface the required service. Instead of that, the Spring class StatelessSessionBeanFactory tries to cal the service on the home interface.

        Comment


        • #5
          Andreas said:
          Try out the newest Spring version. There has been a bug which has been fixed meanwhile.
          Yes, this is the bug I had and since the new release is supposes to have fixed it, it means that the problem is solved. Many thanks.
          Nicolas

          Comment


          • #6
            Same problem using Spring 3.0.5

            Hi, we are using Spring 3.0.5 and Websphere 6.1.0.27 and we have the same problem:

            java.lang.NoSuchMethodException: es.xxx.bpm.ejb._GestorTareasUsuarioHome_Stub.compl etar(es.xxx.bpm.api.dto.ContextoBPM, java.lang.Long, java.util.Map)

            We are configuring the businessInterface correctly but the Home interface it's being used instead.
            Code:
            <bean id="taoBPMClient" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
            	  <property name="jndiName" value="GestorTareasUsuario"/>
            	  <property name="businessInterface" value="es.xxx.bpm.ejb.GestorTareasUsuario"/>
            </bean>
            Is it possible that the same bug explained in (https://jira.springsource.org/browse/SPR-4319) has been introduced again or we are doing something wrong?

            Thanks.

            Comment


            • #7
              Similar issue trying to use &lt;jee:local-slsb&gt;

              Originally posted by javipal View Post
              Hi, we are using Spring 3.0.5 and Websphere 6.1.0.27 and we have the same problem:

              java.lang.NoSuchMethodException: es.xxx.bpm.ejb._GestorTareasUsuarioHome_Stub.compl etar(es.xxx.bpm.api.dto.ContextoBPM, java.lang.Long, java.util.Map)

              We are configuring the businessInterface correctly but the Home interface it's being used instead.
              Code:
              <bean id="taoBPMClient" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
              	  <property name="jndiName" value="GestorTareasUsuario"/>
              	  <property name="businessInterface" value="es.xxx.bpm.ejb.GestorTareasUsuario"/>
              </bean>
              Is it possible that the same bug explained in (https://jira.springsource.org/browse/SPR-4319) has been introduced again or we are doing something wrong?

              Thanks.
              I am experiencing a similiar problem (NoSuchMethodException) while trying to use <jee:local-slsb> configuration via the spring 3.0.5 version.

              The <jee:remote-slsb> configuration actually works as expected, but unfortunately, for our production environment deployment... I will have to run this application within the same local server.

              Hopefully someone watching this forum might have a suggestion and/or a solution as to what is causing this particular issue.

              Comment

              Working...
              X