Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

inject an ejb into jax rs restful service

inject an ejb into jax rs restful service  using -'java,rest,java-ee,ejb,jax-rs'

I'm trying to inject a Stateless EJB into my JAX-RS webservice via annotations. Unfortunately  the EJB is just null and I get a NullPointerException when I try to use it.

public class BookResource {

    private BookEJB bookEJB;

    public BookResource() {

    public Book getBookById(@PathParam("bookId") Integer id)
        return bookEJB.findById(id);

What am I doing wrong?

Here is some information about my machine:

Glassfish 3.1
Netbeans 6.9 RC 2
Java EE 6

Can you guys show some working example?

asked Oct 19, 2015 by 20shahi
0 votes

Related Hot Questions

Government Jobs Opening