Blog Compass Lite 2.0 - personal blog About Me Album Bookmarks

Tuesday, February 14, 2006

EJB Create failure - EJB Home has no no-arg create() method

Is the reference to the remote EJB marked as lazy-init? If not, maybe you should give that a try.
I recall reading something that preinstantiating may cause problems in such cases. I am not sure if it was about this kind of problem, but possibly it might help marking that remote bean as lazy-init.

EJB Create failure - Spring Framework Support Forums.

Problem Scenario:

When trying to deploy remote EJB with springframework on Weblogic 8.1, the following AspectException was thrown:

[EJB home [ClusterableRemoteRef(-6290068137485291364S:[7001,7001,-1,-1,7001,-1,-1,0,0]:mydomain:myserver [-6290068137485291364S:[7001,7001,-1,-1,7001,-1,-1,0,0]:mydomain:myserver/299])/299] has no no-arg create() method]

While I was pretty sure the interface, Home interface, bean class, applicationContext.xml, ejb-jar.xml and weblogic-ejb-jar.xml are quite properly configured. Most importantly, the no-arg create() method is properly in place.


The seemingly most irrelevant suggestion has solved the problem. In applicationContext.xml, set the <bean> to be lazy-init as follow:

<bean id="beanName" lazy-init="true" class="org.springframework.ejb.access.
  <property name="jndiName" value="jndi-beanName"/>
  <property name="jndiTemplate">
    <ref bean="IICJndiTemplate"/>

For jndiTemplate and introduction of kickstarting remote EJB configuration, please refer to the links listed below:

weblogic-ejb-jar.xml Deployment Descriptor Reference
Zabada Technology: Accessing A Remote EJB With Spring
Chapter 17. Accessing and implementing EJBs
EJB Tutorial

I have spent two and a half days on this issue and eventually the JNDI lookup and EJB creation are both successfully achieved. Subsequently there are runtime errors but at least it was one step forward.