Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetty 8 + EJB 3.1 + JTA + CDI + JPA 2 stack?

Can anyone tell me if it is currently possible to "glue together" a partial Java EE 6 Web Profile over Jetty? I've found a lot of articles about integrating standalone EJB 3 containers, JTA providers, etc with older Jetty versions, so I wounder if I could make it all work together. I would like to assemble a Servlet 3.0 + CDI + EJB 3.1 + JTA (if needed, all I really want is declarative transaction management) + JPA 2 environment over Jetty 8 (or Tomcat 7 if no Jetty alternatives are available). My questions are: Can it be done? Has anyone managed to do that? Any articles about getting OpenEJB, Atomikos, Weld, EclipseLink and Jetty (or any other similar stack) working together? Any magical "do it all" pom.xml files out there?

PS: Yeah, I know I could just use GlassFish (which I like very much). I'm just wondering about how hard would it be to get something similar working with a Servlet Container, and how the two environments would compare in terms of complexity, performance, size, deploying speed, hardware resource consumption, etc.

like image 285
Anthony Accioly Avatar asked Apr 15 '11 14:04

Anthony Accioly


4 Answers

I'd describe this as still in the early stages, but here is what we have so far:

http://svn.apache.org/repos/asf/openejb/trunk/openejb3/assembly/openejb-jetty/

Note, Apache TomEE lives at a similar path, i.e. 'assembly/openejb-tomcat'. Plan is to call the Jetty version Apache JetSet and have it be fully embeddable. Most people with commit are currently working on getting Apache TomEE to be officially Java EE 6 Web Profile certified. I'd describe that work to be in the late stages. We've a great setup in Amazon EC2 to run the web profile TCK against TomEE using a hundred EC2 t1.micro spot instances. It's pretty sweet. The TCK agreement with Apache and Oracle does not allow us to share access publicly. However, any Apache committer can sign an NDA to get access.

Ok, so I mention all that about TomEE because the plan is once we're done with the Tomcat version, to do it all over again with Jetty (JetSet). Many of us committers, myself and Jonathan Gallimore for example, actually prefer Jetty by a large margin. But as the Tomcat integration code was much further along and had more users, we decided to just finish that one first. There is an incredible amount of work that isn't Tomcat specific that we will be able to leverage in the Jetty version; getting access to the TCK legally, the heaps of code to get it to run, the more heaps of code to get it automated, and numerous integration bits which are generic and not specific to Tomcat.

All that said, there's no reason others have to wait to work on a Jetty version just because most of us are still finishing the Tomcat version. Apache projects should be viewed as individuals working together, not companies like Oracle or Redhat or VMWare. That can be both good and bad. The good part is that if you or anyone else wants to hack on the Jetty version you can do that right now. You'll have to submit patches for awhile till you earn commit, but having someone else do the actual commit command is not that bad. If you start small and stay active and open, it's usually pretty easy to earn commit. The key to getting patches in quickly is a steady stream of small to moderately sized patches. Any step forward or sideways with no steps backward is a good patch in my opinion. As long as people can see where you're going it's good enough. Certainly more Agile than the one-big-patch approach and allows for all the really fun and collaborative magic to happen along the way.

Some threads which would be good places to say hello. Step 1 is just to say hello. No need to have code in hand to talk on the dev list or be taken seriously:

http://openejb.979440.n4.nabble.com/Jetty-Integration-td1457408.html http://openejb.979440.n4.nabble.com/Jetty-Integration-td2318962.html

like image 163
David Blevins Avatar answered Oct 14 '22 05:10

David Blevins


Tomcat has that stack implemented in a server called TomEE(formerly TomTom).

These are the components it uses.

Connector    Apache Geronimo Connector
CDI  Apache OpenWebBeans
EJB  Apache OpenEJB
Javamail     Apache Geronimo JavaMail
JPA  Apache OpenJPA
JSF  Apache MyFaces
JSP  Apache Tomcat
JSTL     Apache Tomcat
JTA  Apache Geronimo Transaction
Servlet  Apache Tomcat

As far as Jetty I'm not sure. OpenEJB is your only option for EJB outside of a JavaEE6 container(AFAIK) and I'm not sure Jetty is 100% tested with this. For CDI you can always use something like Seam.

In my opinion I believe the Spring framework would be your best option for the Jetty container(that's just my opinion though). In my experience after trying to get Tomcat working with Open EJB, Spring is a lot easier to set up.

You also have to remember Open EJB doesn't implement the entire EJB 3.1 stack at this point.

Also Open EJB is not tested on Tomcat 7 either. So you have to stay with Tomcat 6 if you go that route.

like image 43
Drew H Avatar answered Oct 14 '22 05:10

Drew H


OpenEjb has not released a version with JPA2 support, although their development version supports JPA2 fine AFAIK. I'm using embedded OpenEjb in Jetty6, because I could not get my app working in newer jetties yet. I think there is work under way to get an OpenEJB tightly integrated with Jetty like TomEE, but that may be some way off..

like image 2
AmanicA Avatar answered Oct 14 '22 05:10

AmanicA


Geronimo is a complete J2EE stack which runs on top of Jetty.

There's a document on its setup on https://cwiki.apache.org/GMOxDOC30/configuring-virtual-host-in-jetty.html

like image 2
Quartz Avatar answered Oct 14 '22 07:10

Quartz