Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8179

Re: Java EE on tomcat?

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java EE on tomcat?
Date 2011-09-21 11:19 -0700
Organization http://groups.google.com
Message-ID <12076840.62.1316629181108.JavaMail.geo-discussion-forums@vbac9> (permalink)
References (2 earlier) <j55rfb$9sg$1@speranza.aioe.org> <Hnvdq.23201$Ll3.5551@newsfe16.iad> <j58f7c$4up$1@speranza.aioe.org> <utYdq.12449$Ol1.5245@newsfe07.iad> <ee7db784-e370-40c7-954e-bfa2977c49a9@u20g2000yqj.googlegroups.com>

Show all headers | View raw


nroberts wrote:
> Apparently the decision to move to Tomcat was simply one of
> standardization.  I think perhaps the decision was made a while back.

"Let's standardize on Betamax for our on-demand movie streaming service."

Standardization is good as long as the standard actually applies to the problem domain.

> At any rate it was made without me for reasons I do not know.  I was
> told though, when I mentioned being worried that such limits could
> increase development effort, that I can use whatever libraries or
> extensions I need.  This includes things like OpenEJB etc...

As others pointed out, this is not a good approach.  If you need all those things, better to go with Glassfish or Geronimo or JBoss where it's already all there, and just about as lightweight as Tomcat without those things.

> After learning more about these buzzwords and what they actually
> implement though I'm starting to wonder what is left for EJB.  I can
> replace standard Java EE JPA with Hibernate as it implements it now.

Wrong direction.  Standard JPA replaces the old-style Hibernate way.

Since Hibernate directly supports JPA, why would you even remotely consider doing that the ass-backwards way?

Use Hibernate, sure, but use it *as a JPA provider*.  Using "raw" Hibernate leads to trouble.  You wouldn't think so, but it does.  Every single time I've seen Hibernate in the wild, it's used wrong.  Monolithic 'Session' objects, inappropriate calls across message queues, direct references to table surrogate keys (auto-generated integer IDs, if you can believe it!) in the object code, strange manipulations of under-the-hood SQL - I've seen so many crazy things in Hibernate-based applications.  

Using it as a JPA provider (strictly) leads to gentler idioms.  Short-lived 'EntityManager' instances, dependency injection, objects that reference other objects (or collections thereof), not their keys - the benefits accrue.  

Use the JPA mode.

> I can pull in JSF with either the standard implementation or MyFaces
> (and tobago or whatever looks pretty interesting).  I can get

That's not EJB - that is Web.  Tomcat supports JSF quite nicely.

> dependency injection with CDI; I'm thinking this gives me all the

Some things are just easier in an enterprise application server than a web application server, but you're right, Tomcat suffices for a broad category of needs.

Until it doesn't.

> advances in unit testing that EJB 3.1 gave us.  I can get @WebService
> with JAX-WS though I might not even want it.
> 
> Unfortunately, if I use OpenEJB I'm stuck with an older Tomcat as it
> doesn't work with 7.0 yet.  I tried a patched version that someone
> released and it kind of worked I thought, but yesterday I found that
> webservices were bugging out...either that or need a totally different
> way of setting them up that would likely be a nightmare to figure
> out.  I spent a good day on it yesterday just trying to get the ejb
> example webservices to work and the way I fixed it was to stop trying
> to use a patched version and just downgrade Tomcat.


Don't use OpenEJB.  Don't use EJBs at all.

> I'd rather not base a new project on old technology that's just going
> to end up obsolete the next release if I can at all help it.
> 
> Another thing about the previous technologies I listed is that I can
> put them in my app's WEB-INF folder; I don't have to install them in
> Tomcat.  Perhaps OpenEJB is the same way but I've not seen clear
> documentation on doing so.

Putting "them in [your] app's WEB-INF folder" is not the right way to deploy applications.  Oh, wait, you mean "deploy in your application's WAR file".  Okay, that's all right.  Your terminology confused me for a second.


> What is it that EJB offers me that I don't get with these other
> standard technologies?  I thought it was things like SessionBeans and
> such, but if I use the CDI and JSF bits it seems like I get a lot of
> the same behavior because I've got @ManagedBean or @Named.  I'm
> finding this confusing.

ManagedBean and SessionBean are not the same thing.

JSF is a front-end technology.  EJB is a middleware technology.  Different layers with different purposes.

That the behaviors are similar is a help to learning them, but do not make the mistake of thinking that that makes them the same thing.  They are not.

That said, you should avoid EJBs at first anyway.  Write web apps for a while until you know what you are doing.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-08 10:53 -0700
  Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-08 11:22 -0700
    Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-08 12:08 -0700
      Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 17:48 -0400
    Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 17:56 -0400
  Re: Java EE on tomcat? markspace <-@.> - 2011-09-08 12:36 -0700
  Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 17:41 -0400
    Re: Java EE on tomcat? Torsten Kirschner <torsten.kirschner@gmail.com> - 2011-09-19 00:30 +0200
      Re: Java EE on tomcat? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-18 20:44 -0300
        Re: Java EE on tomcat? Torsten Kirschner <torsten.kirschner@gmail.com> - 2011-09-20 00:20 +0200
          Re: Java EE on tomcat? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-20 05:50 -0300
            Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-21 08:45 -0700
              Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-21 11:19 -0700
                Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-21 11:31 -0700
                Re: Java EE on tomcat? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-21 17:37 -0300
                Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-21 11:29 -0700
                Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-21 14:26 -0700
                Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-22 10:27 -0700
                Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-22 13:30 -0700
                Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-21 20:40 -0400
              Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-21 20:35 -0400
                Re: Java EE on tomcat? nroberts <roberts.noah@gmail.com> - 2011-09-22 10:23 -0700
                Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-22 13:38 -0700
                Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-22 21:15 -0400
      Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-19 21:55 -0400
        Re: Java EE on tomcat? eric@invalid.com (EricF) - 2011-09-21 04:38 +0000
          Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-21 20:29 -0400
            Re: Java EE on tomcat? eric@invalid.com (EricF) - 2011-09-22 02:41 +0000
              Re: Java EE on tomcat? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-22 06:08 -0300
                Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-22 21:18 -0400
              Re: Java EE on tomcat? Lew <lewbloch@gmail.com> - 2011-09-22 08:39 -0700
                Re: Java EE on tomcat? Robert Klemme <shortcutter@googlemail.com> - 2011-09-22 22:58 +0200
              Re: Java EE on tomcat? Arne Vajhøj <arne@vajhoej.dk> - 2011-09-22 18:47 -0400
                Re: Java EE on tomcat? eric@invalid.com (EricF) - 2011-09-24 04:45 +0000

csiph-web