facebook

Difficulty injecting Stateless Session EJB 3 into servlet

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #273221 Reply

    maximuszen
    Member

    SERVLET
    @EJB(name=”T2FacadeLocal”)
    private T2FacadeLocal t2fl;

    public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    T2 t2 = new T2(“hello”);
    t2fl.save(t2); // I get a null point exception here

    BEAN


    @Entity

    @SequenceGenerator(name=”t2_sequence”, sequenceName = “t2_seq”)
    public class T2 {

    private static final long serialVersionUID = -2L;

    private Long id;
    private String x;

    public T2(String x) {

    this.x = x;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “t2_sequence”)
    public Long getId() {
    return id;
    }

    public void setId(Long id) {
    this.id = id;
    }

    public int hashCode() {
    return (this.id == null) ? 0 : this.id.hashCode();
    }

    public boolean equals(Object object) {
    if (object instanceof T2) {
    final T2 obj = (T2) object;
    return (this.id != null) ? this.id.equals(obj.id)
    : (obj.id == null);
    }
    return false;
    }

    public String getX() {
    return x;
    }

    public void setX(String x) {
    this.x = x;
    }

    }

    #273235 Reply

    Loyal Water
    Member

    Can you go through the posting guidelines thread at the top of the forum and post all the information here for me.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Difficulty injecting Stateless Session EJB 3 into servlet

You must be logged in to post in the forum log in