1 Reply Latest reply on Jul 27, 2007 10:47 AM by Max Rydahl Andersen

    How to lookup EJB 3 session bean from servlet?

    maximuszen Newbie

      I get a NullPointException at the save line.

      public class Test extends HttpServlet {

      private static final long serialVersionUID = -1L;

      private T2Facade t2fl;

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

      T2 t2 = new T2("hello");

      LogUtil.log("t2.getId() = "+t2.getId(),Level.INFO,null);
      LogUtil.log("t2.getX() = "+t2.getX(),Level.INFO,null);

      public class T2Facade implements T2FacadeLocal {

      private EntityManager em;

      public void save(T2 t2) {

      // em.persist(t2);

      @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;
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "t2_sequence")
      public Long getId() {
      return id;

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