Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB injected with @EJB on a RESTFul resource

Savio Barros
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that possible use @EJB annotation in a rest resource, which is not a EJB itself? I mean, something like below:

public class CustomerResouce {

MyEjb myEjb;

public List<Customer> getCustomersByCity(@PathParam("city") String city) {
return cityQuery.getResultList(city);


I tried but my EJB always is null. On a JEE7 container (JBoss Wildfly) I could get a valid instance, but on a JEE6, getting null...

Many thanks

Savio Barros
You've gotta fight it! Don't give in! Read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!