Which Java EE technologies to use? [closed]
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 fu开发者_如何学Goll-fledged Java EE server is better, GlassFishV3 for example?
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.
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.
精彩评论