开发者

Integrating EJB3 with Spring

I'm building application with EJB and Spring 3. I have three maven modules - Spring jars, EJB jar and web part. In the web part I want to call my EJB session bean. Here comes the code of it:

@Controller
public class IndexController {

 @EJB
 PaymentRemote paymentRemote;
}

I have also an application context file, with the content:

<jee:local-slsb id="paymentRemote" jndi-name="ejb/myBean" 
   business-interface="net.learntechnology.ejb.PaymentRemote"/>

and

<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor">开发者_开发百科;
 <property name="alwaysUseJndiLookup" value="true"/>

In my ejb module I have an interface:

@Local
public interface PaymentRemote {
}

Unfortunately when I deploy it on JBoss as 5 i get the following error:

Error creating bean with name 'paymentRemote': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: ejb not bound.

I saw a lot of examples in net and all are configured like this. I'm stuck with it... Could any one help me with this? I would be more than grateful!


For JBOSS the proper pattern is: application-name/bean/remote or local


Since my comment turned out to be the answer, I'll rephrase it....

Make sure that the EJB is actually bound to JNDI under the name you're expecting. The error message suggests that it's not.

In JBoss, to the JMX Console, look for the JNDIView object, and invoke its list method. If your EJB is present on ejb/myBean, it should appear here. If not, look for its under a different name, and bind to that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜