View Full Version : Spring and EJB3
yuriy_zubarev
Jul 21st, 2005, 12:56 PM
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
Rod Johnson
Jul 21st, 2005, 03:09 PM
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.
yuriy_zubarev
Jul 21st, 2005, 03:45 PM
Thanks.
What about Spring and EJB3 STSB? Is it possible already?
Regards,
Yuriy
yuriy_zubarev
Jul 22nd, 2005, 11:28 AM
I don't believe no one knows what the deal is with EJB3 and Spring. Don't get shy guys.
Regards,
Yuriy
sbeigel
Jul 29th, 2005, 06:17 AM
Using the JBoss EJB3 preview I retrieve my SLSB quite simple via
<bean id="userManager" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>foo.service.UserManager</value></property>
</bean>
Sebastian
Juergen Hoeller
Aug 6th, 2005, 04:12 PM
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
tirzaman
Aug 6th, 2007, 09:58 PM
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 ?
baocean
Oct 3rd, 2007, 08:13 AM
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
<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.FileMediaAc ceptorManager"/>
</bean>
Then you can inject mediaAcceptorManager wherever you want
tirzaman
Oct 3rd, 2007, 11:39 AM
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.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.