• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can Servlet use DI to access EJB

 
Alain Dickson
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Can I use DI (@ EJB ) in servlet to access EJB methods, instead of using Naming service.
Both Servlet and EJB(Session/Entity) being on the same JEE Server.

Thanks,
Alain
 
Ankit Garg
Sheriff
Posts: 9591
34
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can use injection in your servlet. I have done that in EAR projects with 1 EJB module and 1 WAR module but as far as I remember, this doesn't work on jBoss 4.x...
 
Alain Dickson
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit...
But if JBoss 4.x is JEE5 compliant it should support Injection services...., With which server did you try injecting EJB.
Alain.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But if JBoss 4.x is JEE5 compliant ...


It isn't. Read this. JBoss AS5 has this support. You can use the latest available 5.1.0 release.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!