Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3 Dependency Injection confusion  RSS feed

 
Shayan Shah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi

Can we inject an ejb to a servlet given that the ejb module and web module are not packaged in an EAR but deployed in same container instance?? I am facing problems in this kind of situation.
I wonder if this is even supported or not? I am using JB0SS 5.1.

Thanks

 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can inject EJB reference in a Servlet. In fact this is one of the few things supported as far as EJB injection is concerned.
 
Shayan Shah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you didnt got my question. EJB can be injected to servlet but if both web module and ejb module are in same EAR. The problem I am facing in injection is when both are not in same EAR. EJB module is deployed as JAR and web module is deployed as WAR. What about DI in this situation??
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shayan Shah wrote:
Can we inject an ejb to a servlet given that the ejb module and web module are not packaged in an EAR but deployed in same container instance?? I am facing problems in this kind of situation.
I wonder if this is even supported or not? I am using JB0SS 5.1.



In JBoss AS, if you are deploying them as separate applications, you can get it injected using the mappedName attribute:


Without the mappedName, it's not yet supported https://jira.jboss.org/jira/browse/JBAS-6332
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!