Jetty 8 + EJB 3.1 + JTA + CDI + JPA 2 stack?
Asked Answered
C

4

7

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.

Curium answered 15/4, 2011 at 14:33 Comment(2)
@AmanicA, thanks for editing the tags, hopefully this will bring more attention to the post.Curium
We're in the process of certifying Apache TomEE (mentioned below) in the OpenEJB project. When that is done, we hope to do a Jetty stack as well and call it Apache JetSet. It's actually started already, if you want to hack on it and be part of bringing that to the world, great! The more the merrier! :) Just say hi on the [email protected] list. Most the project is simply developers who use this stuff at work and are creating the platforms they want to use. We're actually aiming at the Jetty version to be fully embeddable, unlike the Tomcat version.Lennox
L
9

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

Lennox answered 3/5, 2011 at 23:6 Comment(1)
David, thank you very much,I will track progress for now and as soon as I find some free time I will try to submit some small patches. Cheers.Curium
T
4

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.

Teratism answered 27/4, 2011 at 13:41 Comment(4)
Cool. I will check TomTom. Besides Open EJB I'have found some references to EasyBeans. Spring + AOP Transactions is a good alternative to the stack.Curium
Anyway, I was just wondering about putting together an alternative Java EE 6 Web Profile stack together, and see how it would compare to GlassFish in terms of turnaround time, container overhead, performance, etc. I've always been a huge fan of Jetty for developing environments.Curium
Thanks for pointing out EasyBeans. I haven't heard of that before. I will definitely check that out. I would actually be very interested to find out your results because Jetty and Tomcat are much lighter than Glassfish from what I've seen, but they are just servlet containers. We use Glassfish 2 and 3 in house at my company but I'm always looking for ways to get things working in Tomcat. Especially for side work I do. I use Tomcat shared hosting on the side because it is a lot cheaper than a VPS solution with Glassfish. So I'm usually stuck with Spring.Teratism
Note that OpenEJB does have full EJB 3.1 support in trunk, it's just not certified yet. We're hoping to be able to make some Apache TomEE and Apache Geronimo certification announcements in the next quarter. Note on EasyBeans, definitely do check it out, but also note it is also not certified.Lennox
T
2

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..

Terms answered 29/4, 2011 at 20:51 Comment(2)
Yeah, I'm also stuck with Jetty (7) + Spring + Hibernate 3.5 stack. I'm also close following Jetty 8 roadmap. Am I the only crazy guy pursuing a Frankenstein web profile? I mean, Java EE 6 and Glassfish have been around for a while now. I was pretty sure there would be a magic pom file / maven archetype out there for a "lightweight" web profile stack.Curium
Status update on JPA2. In early March we took 3.1.x and branched it and merged in the JPA2 support from trunk. Things are looking good and we hope to have this new branch, called 3.2, up for a release vote in a week or two. Note, trunk is now called 4.0. Thank Thiago Veronezi for all that great work. Another user turned committer.Lennox
G
2

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

Gusto answered 26/1, 2012 at 19:32 Comment(1)
The document is not found :)Phthisic

© 2022 - 2024 — McMap. All rights reserved.