Search code examples
primefacestomcat7glassfish-3ejb-3.1

EJB3.1 and JSF issue with Tomcat 7


Could JSF2 webapplication with EJB3.1 POJOS executed in Tomcat7 without changing the annotations @EJB entity and EJB3.1 related code.

I am using PrimeFaces 3.4.x, Eclipselink JPA 2.3,EJB3.1

And finally I would like to stick to Tomcat7 without using JavaEE6 server, because some customers could not migrate to new Java EE servers due to internal constraints.

But I want native queries and/or criteria queries works well with JPA like joins(left, outer,& inner joins), insert in multiple tables etc.

My journey with GlassFish3.1 was pretty good with primefaces CRUD application with EJB3.1,Eclipselink JPA.

But I could not execute my application because EJB session bean fails to instantiate, without changing the EJBs code.

I am thinking to change the design and source code so that my application runs in Tomcat 7 and Glassfih3.x. May be avoid EJB3.1 and use some thing like DAOs, etc. (i.e. go with J2EE pattern instead of Java EE6 pattern).

EJB3.1 code snippet of UsersController.java:-

@EJB

(1) private com.myapp.session.UsersFacade ejbFacade;

(2) private UsersFacade getFacade() { return ejbFacade; }

// validateUser() method returns a String. (3) String ressult = getFacade().validateUser();

perisistence.xml file

http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> jdbc/ABC false


Solution

  • No. Or re-design the application without using EJBs before migrating to Tomcat 7.