14

I have a simple question (and silly - shame on me :)

As far as I understand, Tomcat is a web container which implements Servlet/JSP specifications. Tomcat is not a full-powered Java EE app server - therefore, I cannot deploy and run a EJB-based application on Tomcat.

So far so good.

But... I'm able to deploy and run JSF applications on Tomcat. JSF - as far as I understand - it's part of Java EE and is "backed" by EJBs (e.g., you use stateless/stateful beans).

Bottom line: Why am I able to run JSF applications backed by EJBs and not able to deploy a "regular" EJB application (i.e., non-JSF).

Thanks in advance =)

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
  • 4
    JSF is not backed by EJB, is a framework built on top of Servlets. – Luiggi Mendoza May 15 '12 at 00:49
  • 1
    Hi - thank you, Luiggi. Whilst I was coding using JSF (I have to confess that I'm quite new at JSF) I thought the backend classes were EJBs. My bad. Cheers. –  May 15 '12 at 00:56
  • 1
    You can find more information in the [JSF Specification](http://javaserverfaces-spec-public.java.net/) and [Oracle documentation](http://docs.oracle.com/javaee/5/tutorial/doc/bnaph.html). – Luiggi Mendoza May 15 '12 at 00:59
  • 1
    They're not EJBs, they are 'just' beans. – user207421 May 15 '12 at 01:04
  • Yeah, I've been using the Oracle documentation quite a lot - but so far I haven't come across any part of it clearly stating that the backend classes aren't EJBs - that's why I was getting confused. Thanks again mate =) –  May 15 '12 at 01:07
  • Also note that Java EE != EJB. EJB is a part of Java EE, but just one of the many parts. While EJB is an important part, it's hardly the overwhelming defining part of Java EE that it sometimes is made out to be. – Arjan Tijms Apr 30 '13 at 20:32

1 Answers1

4

As others have clarified, EJB != JSF. That said, you can get EJBs to work with Tomcat and JSF via Apache TomEE. You can drop it into a Tomcat 7 install or just use a binary which is already setup. TomEE was built exactly to answer the "who do I use X on Tomcat" question.

Here is also a getting started video which shows EJBs, CDI working on Tomcat hooked up to Eclipse.

David Blevins
  • 19,178
  • 3
  • 53
  • 68