views:

81

answers:

2

Hello All,

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!

+1  A: 

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

Agata
+1  A: 

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.

skaffman