[jboss-user] [JNDI and Naming] - Re: lookup a session bean inside a servlet

Andrzej Goławski do-not-reply at jboss.com
Thu May 5 09:42:24 EDT 2011


Andrzej Goławski [http://community.jboss.org/people/andi-g] created the discussion

"Re: lookup a session bean inside a servlet"

To view the discussion, visit: http://community.jboss.org/message/603699#603699

--------------------------------------------------------------
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
[http://community.jboss.org/message/603699#603699]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110505/e8e5e164/attachment.html 


More information about the jboss-user mailing list