JBoss Community

Re: lookup a session bean inside a servlet

created by Andrzej GoĊ‚awski in JNDI and Naming - View the full discussion

No problem :)

 

Try to use:

 

@Stateless

@LocalBinding(jndiBinding = "myProject/OperazioniUtenti/local")

public class OperazioniUtentiBean implements OperazioniUtenti

 

then you'll be able to write in your servlet:

 

lookup("myProject/OperazioniUtenti/local")

 

For remote:

 

@Remote

@Stateless

@RemoteBinding(jndiBinding = "myProject/OperazioniUtenti/remote")

public class OperazioniUtentiBean implements OperazioniUtenti

 

Remember to use @Remote while using @RemoteBinding.

 

Good idea (in my opinion) is to create two separated jars:

     1.  BookShop.jar or BookShopImpl.jar to keep Beans' implementations (EJB)

     2.  BookShopApi.jar to keep only interfaces

 

After that you can safely put BookShopApi to WEB-INF/lib dir or include to other client's application.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community