1

We're building a web service from scratch, right from deciding what Java EE technologies to use.

It looks like Apache-cxf is a good choice as the frontend. For accessing database, Hibernate looks like a good candidate. What about the business logic in between? Should EJB3 be used?

If EJB3 is NOT used, is Tomcat is good candidate as the App server? If EJB3 IS used, is Tomcat still good? Or a full-fledged Java EE server is better, GlassFishV3 for example?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
sarahTheButterFly
  • 1,894
  • 3
  • 22
  • 36

2 Answers2

3

Glassfish v3.1 using the EJB Lite profile is what you want.

It comes with JPA (based on Eclipselink), it comes with WebServices (JAX-WS via Metro), it comes with Local EJB session beans (part of the EJB-Lite profile). This lets you put the EJBs in your WAR, simplifying deployment. That gives you transaction demarcation at the session bean level, quite nice.

It's the whole stack, you don't have to install anything, configure anything, download jars from anywhere (save Glassfish of course). It's all built it.

Add NetBeans IDE, and you get the whole kit, including Glassfish.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
  • 1
    You think of the Web Profile? – Thorbjørn Ravn Andersen Apr 30 '11 at 23:00
  • 1 + for bundle it all pack. Netbeans can also, optionally install Tomcat. – Anthony Accioly Apr 30 '11 at 23:01
  • @Thorbjorn (don't have a Norwegian keyboard), what is the Web Profile? – sarahTheButterFly Apr 30 '11 at 23:05
  • @Will, does Eclipse work well with Glassfish? We are an Eclipse house. My impression from searching this forum is that GlasshFish has the plugin for Eclipse, but doesn't work smoothly. Also, I've heard the rumor that Oracle might not support Glassfish in the future? – sarahTheButterFly Apr 30 '11 at 23:07
  • @sarah, Java EE 6 Web Profile is a smaller subset of the full Java EE standard useful to those who wants something just a bit bigger than what a normal WAR offers. Glassfish works well with Eclipse after installing the Glassfish Server ADapter from the Eclipse Markedplace. – Thorbjørn Ravn Andersen Apr 30 '11 at 23:16
  • what about JSF? It is also included? – SJuan76 Apr 30 '11 at 23:29
  • @Thorbjorn, what do you mean by "something just a big bigger"? (Sorry, I am a novice JEE developer) – sarahTheButterFly Apr 30 '11 at 23:29
  • @sarah: The Glassfish v2 Eclipse plugin was terrible. The GF 3 Eclipse plugin is plain awesome. @Thor: just curious, did @Thorbjorn work for you? @SJuan: JSF is definitely included in GF 3 (web profile). – BalusC Apr 30 '11 at 23:30
  • @BalusC. Good to know, Thanks. My impression of Glassfish is that it is for tutorials! Do people really use it for serious enterprise applications? – sarahTheButterFly Apr 30 '11 at 23:34
  • @sarah, have a look at http://blog.eisele.net/2010/05/about-java-ee-6-web-profile-und-java-ee.html - it explains what it is about. Glassfish v3 is fine for production. @BalusC, if you ask if it showed up in my upper left, then yes. They match rather leniently. – Thorbjørn Ravn Andersen Apr 30 '11 at 23:35
  • @sarah: you're referring to the Java EE tutorial? Read this: http://stackoverflow.com/questions/165230/is-the-offical-sun-java-ee-tutorial-the-best-way-to-learn-how-to-make-java-web-ap/1876535#1876535 @Thorbjorn: good to know :) – BalusC Apr 30 '11 at 23:36
  • @sarah. Yes, they do. I used JBoss, GlassFish and a lot of commercial Application Servers in a lot of successful projects. And I also used Tomcat and Jetty for a lot of others. It's a matter of using the right tool for the right job (or rather, using the stack that your client paid for :D). – Anthony Accioly Apr 30 '11 at 23:38
  • No, the Web Profile is different. The Web Profile is basically a servlet container that can say its "JEE" compliant, versus before when you need to support the entire stack to say you were JEE compliant. JEE EJB Lite is like a halfway bridge between pure servlet and full boat EJB. Basically it gives you easier deployment (just a WAR vs an EAR) and stateless session beans. You don't get Message Driven Beans or a bunch of the other EJB stuff (like connectors). But you get SSBs and transactions (the major benefit that EJB brings, frankly). – Will Hartung Apr 30 '11 at 23:55
  • @Sarah, for sure Glassfish is good for production. We have it deployed all over the place, managing millions of rows of data, and handling 100's of thousands of transactions a day. – Will Hartung Apr 30 '11 at 23:57
  • 1
    @Will. Thanks for reassuring me that. @BalusC, I'm reading the "Beginning Java EE 6 Platform with GlassFish 3:" book you mentioned in here http://stackoverflow.com/questions/165230/is-the-offical-sun-java-ee-tutorial-the-best-way-to-learn-how-to-make-java-web-ap/1876535#1876535. It's just what I needed! – sarahTheButterFly May 01 '11 at 09:56
3

Basically your are asking a question that most Java Developers did at some point or another of their careers. Should I go with a full blown application server or a simpler container with some open source stack above it. A couple of years ago I would advice you to go with Tomcat (or Jetty), Spring and whatever open source stack you feel confortable with. The lower turnaround time would compensate for the extra time needed to put everything together, your solution would be more "lightweight" and simple. Today Java EE 6 Web Profile is pretty simple and lightweight, GlassFish has a decent deploy and publishing time, and EJB 3.1 is far from being the monster it once was (say EJB 2). You will just fire your App Server and pretty much everything is already setup for you (at the cost of, maybe, a little extra "service layer overhead" compared to using a "assemble it yourself" Frankenstein container). So, it is a matter of personal taste, your application may not need EJB (or Spring), or it may need it (and you can always go with Tomcat + Open EJB or EasyBeans as an alternative to GlassFish). As an experienced Java EE developer migrating to Java EE 6, I can say that I'm also wondering about what approach is the best (see Jetty 8 + EJB 3.1 + JTA + CDI + JPA 2 stack?). Just not to leave you with a empty answer, currently I'm inclined toward GlassFish (as I said, the setup and turnaround time is pretty satisfactory, and I think it is a lot easier to scale using a GlassFish cluster than doing it with Tomcat + Apache + Load Balance + MemCached / Terracota / whatever). But take that (and any other answer you receive tending toward either Tomcat 7 or GlassFish) as a matter of personal opinion.

Community
  • 1
  • 1
Anthony Accioly
  • 21,918
  • 9
  • 70
  • 118