views:

3377

answers:

14

I'm starting a new project now. I have to choose technologies. I need something light, so no EJB or Seam. On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces. Do you think that such a stack on Spring 3 deployed on Tomcat is a good choice? Or a JEE6 web application could be better? I'm afraid that JEE6 is a new technology, not well documented yet. Tomcat seems to be easier to maintain than Glassfish 3.

What's your opinion? Do you have any experiences?

+5  A: 

It doesn't matter. JavaEE6 is good enough and because of the profiles there, it is not "heavy" - you'll just be using the web profile.

Personally, I prefer spring. But I'm running out of rational arguments against JavaEE6 :)

(As I was reminded by a comment - you might want to try richfaces as well as icefaces and/or primefaces - depending on what components you need)

Bozho
So the question is: "Does it make sense to use full-stack Glassfish Application Server just too use web profile" ?
peperg
@peperg Use GlassFish v3 Web Profile if you just want the web profile, see my answer.
Pascal Thivent
@Bozho - I've posted some arguments here http://stackoverflow.com/questions/2822812/spring-3-0-vs-j2ee-6-0/2823389#2823389, rather taken from the "how to take it into production" standpoint. So maybe that fills up your arguments reservoire a little bit.
Oliver Gierke
+1  A: 

I'd choose spring, because it's more familiar to both me and the stackoverflow crowd who can help me when I have a problem. But I agree with Bozho (+1).

John
it will help with JavaEE as well
Bozho
A: 

I'd still prefer Spring.

And I'd pass on JSF. I think it's a dead technology. Spring MVC would be a better alternative. So would Flex. Think in terms of contract first XML services and you can decouple the back end from the UI completely.

duffymo
Do you have Flex+Java experiences to share?
Thorbjørn Ravn Andersen
I've created some applications with Java+Flex and PHP+Flex and I agree that it's the best solution for rich interfaces. But in this application I can't use Flex :( I need some high-level interface though, so Spring MVC is not a solution. I want to think about sortable datatable either than <tr> <td> in a loop.
peperg
What does "high level interface" mean? Why is JSF acceptable and Spring MVC not?
duffymo
Flex + Spring + BlazeDS is a nice combination.
duffymo
@duffymo - I can argue whether flex is a good choice. JSF is definitely not dead, especially with libraries like richfaces, primefaces, icefaces, etc. around.
Bozho
In IceFaces I create menus, trees, datagrids use actions, events and I don't think if page reloads or is it ajax request. An sortable datagrid or ajax loaded tree is a buil-in component. In Spring MVC I operate on HTML - tables, lists etc. I need to use some third party javascript framework and create AJAX magic by hand. I'd like to do it in Flex but it's a political/business decision - not mine.
peperg
@Bozho, I think it's dead because it's not used at all from where I sit. It's not about libraries. I think the mindshare is going to RIA technologies, not JSF. The one application that I saw using JSF was written so poorly and consumed so much memory on the browser that you could time page renderings with a sundial. The team that wrote it might not have been the best, but it wasn't a very inspiring start. JSF is deader than the proverbial doornail.
duffymo
My current two JSF projects are definitely not dead ;) And I'm way more satisfied with the JSF way to build RIA ("rich" in "richfaces" is for that), than using Flex. One is even going public next week.
Bozho
I'd really like to know why you'd still prefer Spring, Java EE 6 is damn good. Don't you think that running on an open platform is important for the future of Java?
Pascal Thivent
No, I don't. I think the calculus changed when Oracle purchased Sun. They aren't the same company. The fact that Spring has been closed for the ten years it's been evolving hasn't hurt the quality or my future at all.
duffymo
Hmm... Spring, which is not ten years old, has taken a dangerous path very recently only (the past doesn't mean anything). And the Java EE standard isn't driven/owned by a single entity, Snoracle can't change this without destroying Java EE (which makes no sense IMO). I'm not following you.
Pascal Thivent
The open source availability of Spring isn't ten years old, but the development of the framework is. "Expert J2EE" was published in 2002, so the development of interface21 preceded the publish date. Are you referring to the VMWare purchase or the separation of the community and professional versions for Spring? I don't know about Oracle destroying J2EE, but it's certainly been dormant for a very long time now. Where's the new version of WebLogic? Where's Java 7? Nothing appears to be happening.
duffymo
I'm referring to Spring being a proprietary container and to the proprietary tc Server. Regarding Oracle, digesting BEA and Sun will clearly take some time: WebLogic 12 has been announced for 2011, don't know for Java 7 (but I don't really care, I want to play with Java EE 6 first).
Pascal Thivent
But offering a proprietary container doesn't preclude using Spring with Java EE standard containers. BEA was purchased a while ago; the Sun deal only closed recently. WebLogic 12 in 2011? That's an eternity since WL 10 came out. I'm not sure that Java EE 6 will be adopted by conservative Fortune 500 companies until after 2011. There's a difference between developers playing with technology and adoption in the workplace. I think Spring is still worth considering: I can use it now.
duffymo
*That's an eternity since WL 10 came out* Yeah, and even more since WebLogic 6 came out :) At least compare to 11g. But I get your point and it will indeed take some time before adoption of "major" Java EE 6 app servers, especially by Fortune 500 companies. Still, GFv3 (and soon JBoss 6, and more) may be an option for some people, like it is for the OP in the context of *this* question. The OP can use Java EE 6 now.
Pascal Thivent
+2  A: 

Read this blog, including comments to get both sides of coin. I will choose Spring for several reasons and following is one of them (reproducing one of the comments from post)

'I am not sure which Java EE 6 server you are talking about. There is Glassfish certified and TMAX JEUS. It will take quite a while (read: years) until Java EE 6 compliant versions of WebSphere, WebLogic, JBoss etc are in production and can be used for real application. Spring 3 just needs Java 1.5 and J2EE 1.4 so can readily be used in almost all environments'

Adi
JEUS JEE6 is not available.
Thorbjørn Ravn Andersen
+13  A: 

I need something light, so no EJB or Seam.

Would you care to explain what makes EJBs heavy since EJB3? Do you realize that we are not in 2004 anymore? I'd really like to read your definition of light and your arguments (and I will update my answer with pleasure because I'm pretty sure I would have a few solid things to say).

On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces.

Java EE 6 Web Profile which includes JSF 2.0, JPA 2.0, Bean Validation, EJB 3.1 Lite, CDI,... would be perfect for this and you can use GlassFish v3 Web Profile to run an application built with the Java EE 6 Web Profile.

Do you think that such stack on Spring 3 deployed on Tomcat is a good choice? Or a JEE6 web application could be better?

Well, I like the idea to run my code on a non-proprietary platform (Java EE) rather than on a proprietary container (Spring). And I think that Java EE 6 is good enough (and this is an euphemism, EJB 3.1 (Lite), JPA 2.0, JSF 2.0, CDI kick ass). Note that I was a JSF skeptic but I took a second look and JSF 2.0 with CDI is so different that I can't even compare. And if you didn't look at CDI, let me tell you that it rocks.

I'm afraid that JEE6 is a new technology, not well documented yet.

Java EE looks pretty well documented to me. This sounds like free claim. And, believe me or not, I start to find Spring getting complicated while Java EE getting easier.

Tomcat seems to be easier to maintain than Glassfish 3.

Did you try something? Did you face any particular problem? Again, this sounds like free claim.

Pascal Thivent
I'm just after rater big project developed with EJB3.0+Seam on JBoss with Drools, GraniteDS and some more. I agree Seam rocks ! But I spent 50% of developement on redeployement, restarting servers, deployment errors, cleaning temp directories etc. On the other hand JBoss Tools performance was really poor (I mean really - ctrl+space and 10s hang) This realy discourages me to use JEE6 which looks like borrowed from Seam framework. As for server I don't want to think about conecion pools, jndi, jms, jmx, ear deplyment. I need something to put WAR on and run in seconds.
peperg
CDI looks like copy-paste from Seam Framework (actualy project Weld IS developed from seam). I can get something similiar in Spring with SpringELResolver.
peperg
@peperg Gaving King is the spec lead of CDI (Weld being the RI) so you'll find similarities between Seam and CDI. But CDI != Seam, Java EE 6 != Seam, your perception is wrong. Maybe try GlassFish v3 Web Profile, you'll be surprised (and once the connection pool defined, there is not much to worry about).
Pascal Thivent
A: 

The answer to your questions depends on your project requirements. If you don't require the JEE features like message queues, container managed global transactions etc then go with tomcat+spring.

Also from experience I have found that projects that require a lot of web service integration, scheduling, message queues are best best done using some of the JEE stack. The good thing is using spring you can still integrate with JEE modules running in an application server.

JEE6 is very different from the previous releases, and it really makes everything lot easier. JEE6 combines the best ideas from the diverse Java community - for instance Rod Johnson from Spring framework was actively involved in the making of the Dependency Injection JSR in JEE6. A benefit of using JEE6 is that you are coding according to a standard, which could be important in some organizations for vendor support etc.

Glassfish v3 supports JEE6 and it is quite light-weight and starts up really fast. I have been using glassfish v3 for my developments, and it is really easy to configure. It comes with a very user-friendly admin console that lets you graphically administer your server.

If you are using GlassfishV3 and JSF 2, then you can take advantage of the CDI features of JEE6, that lets you easily create conversations (e.g. wizard like pages) in JSF.

Having said that, using JEE6 also requires you to learn a new API. Depending on the timeframe available it might not be the best choice for you. Tomcat has been around for ages, and the tomcat+spring combination has been adopted by many web projects, which means lots of documentation/forums are around.

Raz
I do not agree with your first sentence, the choice is not about using JMS or not. And I don't think that JSR-330 is that important in Java EE 6 (it is more there for political reasons), the important part is JSR-299 (CDI). At least, this is my opinion.
Pascal Thivent
Raz
A: 

I'd recommend Spring + Tomcat unless you can wait the time for glassfish v3 and Weld to become more mature. There are currently a few issues with memory consumption/cpu load when running glassfish with CDI enabled applications.

beamso
A: 

I recommended to you Tomcat with Spring because:

  1. Spring can create backing beans for JSP
  2. You will use Spring to persist object through JPA

It is good choice to choose Tomcat because you don't need any heavyweight processing

bassem
"Heavyweight processing"? Could you elaborate? I'm curious.
Pascal Thivent
+2  A: 

My opinion is based on something not mentioned by others, namely that code at my work tend to live for decades (literaly), and hence that maintenance is very important to us. Maintenance of our own code, and the libraries we use. Our own code we control, but it is in our interest that the libraries we use, are maintained by others in the above mentioned decades or more.

To make a long story short, I have concluded that the best way to achieve this is by using open source implementations of Sun specifications all the way down to the raw JVM.

Of the open source implementations Apache Jakarta has proven to maintain their libraries, and recently Sun has done a lot of work in producing high quality implementations for Glassfish v3. In any case, we also have the source for all modules, so if all else fails, we can maintain them ourselves.

Sun specifications are usually very strict meaning that implementations conforming to the spec can be interchanged easily. Just have a look at servlet containers.

In this particular case, I would suggest having a look at JavaServer Faces simply because it is part of JEE6 meaning it will be available and maintained for a very, very long time. Then we have chosen to augment with MyFaces Tomahawk as it gives some useful additions, and it is a jakarta project.

There is nothing wrong with JBoss Seam or others. It is just that their focus is less towards the maintenance issue that is so important to us.

Thorbjørn Ravn Andersen
A: 

Didn't read everything but just to tell that you can now use EJB3 inside a war on JEE6 so you can use EJB3 on tomcat (i think).

Sebastien Lorber
Yes, you can package EJBs in a WAR in Java EE 6 but this doesn't mean you can deploy such a WAR on Tomcat. You need a container implementing the Web Profile and Tomcat doesn't and there is actually no plan in the Tomcat community to implement it (see http://old.nabble.com/Java-EE-6-Web-Profile-td27715793.html). But there is GlassFish v3 Web Profile, there will be Resin...
Pascal Thivent
+1  A: 

Why is there still rumblings about EJB being heavyweight in 2010? It seems people are not being updated in Java EE technologies. Just try it out , you will be pleasantly surprised how things are simplified in Java EE 6.

nash
A: 

I have worked in both Spring and JEE6. What i say from my experience is that..If you are going for the age old JSP or properietory Flex then you are safe if you stay with Spring.

But if you are to move ahead with JSF then its time to shift to JEE 6. with JEE 6 you are moving to facelets and standardized script libraries and component libraries. No more script incompatabilities and component library matrices.

Regarding Spring MVC . Its good until your project dont grow big..If its a huge enterprose application stick on to JEE 6 . Because thats only way you could maintain your own component libraries and resource bundles in a orderly manner.

Thanks for Your comment. My choice was Spring + Vaadin.
peperg
A: 

My feeling is that Spring doesn't support JSF2.0 and Seam/JEE6 yes. At least I have not found any book So if you are going to use JSF I would choose Seam/JEE6.

please correct me if you have different opinions.

enricjv