Announcement Announcement Module
Collapse
No announcement yet.
Spring and EJB3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring and EJB3

    Greetings,

    I'm trying to call EJB3 stateless session bean from a client employing Spring and following example from http://www.springframework.org/docs/reference/ejb.html. I'm getting an exception in reards to home interface:

    EJB home [jboss.j2ee:service=EJB3,name=test.HelloWorldBean] has no no-arg create() method

    Since there is no home interfaces in EJB3 I guess those examples are not really applicable. Does anyone know of any resources showing how to marry Spring and EJB3? I'm also curious on best practices on how to use two technologies together (if it's not too early yet).

    Thanks,
    Yuriy

  • #2
    I'm also curious on best practices on how to use two technologies together (if it's not too early yet).
    I think it is a bit early, as the EJB3 draft is evolving.

    Regarding best practices, we plan to begin work on integration with the EJB3 persistence APIs as soon as the Reference Implementation (announced at JavaOne) is available.

    Comment


    • #3
      Thanks.

      What about Spring and EJB3 STSB? Is it possible already?

      Regards,
      Yuriy

      Comment


      • #4
        I don't believe no one knows what the deal is with EJB3 and Spring. Don't get shy guys.

        Regards,
        Yuriy

        Comment


        • #5
          Using the JBoss EJB3 preview I retrieve my SLSB quite simple via

          Code:
          <bean id="userManager" class="org.springframework.jndi.JndiObjectFactoryBean">
          		<property name="jndiName"><value>foo.service.UserManager</value></property>
          	</bean>
          Sebastian

          Comment


          • #6
            Yes, all you should need to look up EJB3 Session Beans is Spring's JndiObjectFactoryBean, as EJB3 effectively exposes the component interface directly, rather than enforcing the indirection via a home interface. Same goes for an EJB3 EntityManager, which should simply be available at a specific JNDI location.

            Juergen

            Comment


            • #7
              It's now 2007, two years later from your post and I'm having the same issue of "EJB home: ... has no no-arg create() method". I tried your fix mentioned above and I'm getting an "IllegalArgumentException" as Spring cannot convert the EJB proxy to my local interface due to the "no matching editors or conversion strategy was found" error.

              Can anybody please help ?

              Comment


              • #8
                Hi, you are patient though
                I'me developing application which is supposed to run in tomcat using ejb3 persistance and spring transaction demarcation and in jboss using ejb3 full features and spring injections into http handler beans.

                I've just succefully injected ejb3 session bean deployed into jboss using spring.
                Have a look
                Code:
                  <bean id="mediaAcceptorManager" class="org.springframework.jndi.JndiObjectFactoryBean">
                        <property name="jndiName" value="100_personalMediaCenter/FileMediaAcceptorManagerImpl/local"/>
                        <property name="proxyInterface" value="com.primetel.pmc.mediaacceptor.service.FileMediaAcceptorManager"/>
                    </bean>
                Then you can inject mediaAcceptorManager wherever you want

                Comment


                • #9
                  Thanks a lot, baocean. Somehow, I was able to make it work using the following:
                  <jee:jndi-lookup id="ManageMemberService" jndi-name="ejb/ManageMemberEJB" cache="true" />
                  It's pretty weird as I tried those tags and what everybody else on this forum told me to try but it wouldn't work for me. Now, all of a sudden, I got it work. Anyway, thanks for your reply.

                  Comment

                  Working...
                  X