Announcement Announcement Module
Collapse
No announcement yet.
Issues when looking up a EJB3 Bean using SimpleRemoteStatelessSessionProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues when looking up a EJB3 Bean using SimpleRemoteStatelessSessionProxyFactoryBean

    Hi,


    I have deployed a EJB3 Bean(No Remote Home interface) in WAS 6.1 (has EJB 3.1 Feature pack installed).

    Following are my bean details :

    Remote Interface:
    =============

    @Remote
    public interface MyRemoteInterface {

    public void sayHello();

    }

    EJB Bean
    ========

    @Stateless(name="MyBean")
    /**
    * Bean implementation class for Enterprise Bean: MyRemoteInterface
    */
    public class MyBean
    extends AbstractBaseSessionBean implements MyRemoteInterface {

    @Override
    protected void onEjbCreate() throws CreateException {
    }

    public void sayHello(){

    System.out.println("Calling sayHello ");

    }

    }


    This EJB bean is associated with the JNDI(bound to remote JNDI space) name called "ejb/MyBean".


    In my standalone Junit testcase's applicationContext.xml file, I have the following bean defined to look up the above remote stateless bean,


    <bean name="myProxyEJBBean" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
    <property name="jndiName" value="ejb/MyBean"/>
    <property name="businessInterface" value="MyRemoteInterface"/>
    <property name="jndiEnvironment">
    <props>
    <prop key="java.naming.factory.initial">com.ibm.webspher e.naming.WsnInitialContextFactory</prop>
    <prop key="java.naming.provider.url">iiop://localhost:2812/</prop>
    </props>
    </property>
    </bean>

    Stubs for the same EJB classes are generated and set in my client application's(Junit) classpath.

    when i try to access "myProxyEJBBean" bean, i get the following exception:



    org.springframework.remoting.RemoteLookupFailureEx ception: EJB instance [IOR:00bdbdbd000000465726961642e7063746d732e6100000 0250000000400bd0003] is not a Remote Stateless Session Bean
    at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.newSessionBeanInstance(AbstractR emoteSlsbInvokerInterceptor.java:228)
    at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.getSessionBeanInstance(SimpleRemot eSlsbInvokerInterceptor.java:110)
    at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:75)
    at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:140)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)





    But i am able to lookup the same remote EJB bean and invoke methods using InitialContext lookup,

    try {
    ctx = new InitialContext(properties);
    java.lang.Object object = ctx.lookup("MyBean");
    MyRemoteInterface remoteReference = (MyRemoteInterface)object;
    remoteReference.sayHello();
    } catch (Exception e) {
    e.printStackTrace();
    }

    Am i missing anything while defining "SimpleRemoteStatelessSessionProxyFactoryBean" ? or is anyother way to lookup remote stateless session EJB bean in spring framework?.

    Any help would be greatly appreciated.

    Thanks in advance
    Abdul
    Last edited by salamsoft; Feb 18th, 2008, 10:54 PM.

  • #2
    An alternative would be using JndiObjectFactoryBean. Though, the support for EJB3 access via SimpleRemoteStatelessSessionProxyFactoryBean (which has been developed for EJB 2.x) has just been added in a recent version of Spring.
    So if you are not using a recent version of Spring, an upgrade would help.

    Edit: It has been included in version 2.5.1

    Regards,
    Andreas

    Comment


    • #3
      That's thread 50000!

      Joerg

      Comment


      • #4
        Reported not working in 2.5.4:

        http://forum.springframework.org/sho...d.php?p=176137

        Comment


        • #5
          Not working in 2.5.3 either (see my reply in same thread http://forum.springframework.org/sho...d.php?p=176137)

          Comment


          • #6
            I guess I found the problem and opened a Jira issue (http://jira.springframework.org/browse/SPR-4801).

            As a workaround use <jee:jndi-lookup> which works without problem.

            Regards,
            Andreas

            Comment


            • #7
              The problem is fixed in the current 2.5.5 nightly snapshot. It seems that the issue showed up in only some EJB3 containers.

              Comment


              • #8
                Issues when looking up in EJB3 bean

                Hi Andreas, I faced the same problem with Spring2.5.5 ! I used the latest Spring 2.5.5 nightly build. I have EJB3.0 hosted in JBoss4.2.2GA. What can be the issue?
                EJB instance [jboss.j2ee:ear=sample.ear,
                jar=Sample.jar,name=createTest,service=EJB3] is not a Remote Stateless Session Bean ?

                Thanks in advance ,

                Comment


                • #9
                  Actually, I verified the fix with JBoss 4.2.2GA (with added EJB3 support, installed by JEMS 1.2.1CR4) using the Spring 2.5.5 snapshot from 2008-05-13.

                  Based on the code changes made the issue should be fixed. Maybe you could also try debugging into AbstractRemoteSlsbInvokerInterceptor class and see what happens.

                  Regards,
                  Andreas

                  Comment


                  • #10
                    Hey Andreas, managed to solve the problem using <jee-jndi lookup> tag instead. Upgraded to Spring 2.5.5 as well. Thanks !

                    Comment


                    • #11
                      I have the same problem, spring2.5.2, jee:remote-slsbs or SimpleRemoteStatelessSessionProxyFactoryBean => same result. I will try with Spring2.5.5. (I use glassfish)

                      Comment


                      • #12
                        Ok for me too by using the last spring version and jee:* tags

                        Comment

                        Working...
                        X