Help

A developer new to Java EE posted in the Weld forum asking for advice on getting started learning EE 6. I've decided to promote part of my response in the forum to the blog.

So, what should I start learning. Java EE 5 and Seam? Java EE 6 and Weld? Is there any learning material about 6 and Weld right now?

Unless you plan on putting your system into production inside the next 2-3 months, you should start learning CDI and Weld. CDI defines the basic infrastructure you'll use to get the various kinds of Java EE components working together (and much more).

You also need to decide what web framework to use. This is the hard bit for most people.

  • You could use plain servlets and JSP, which in EE 6 both include out-of-the-box CDI integration. However, most people prefer to use something with more features. But honestly, if you're new to enterprise Java, it's not a bad place to start. The latest servlet spec lets you use annotations, which is a big step forward in usability.
  • JSF2 is included as part of the platform, and is integrated with CDI out of the box. Many people find JSF difficult to learn. We believe that for some kinds of applications, it pays off in the end. Unfortunately, most of the books and articles about JSF make it appear much more complex than it actually is. In particular, the specification is horribly written and not worth reading (so I won't link to it). Take a look at the Weld examples to get a taste of what JSF2 is really like.
  • An option we recommend is Wicket. Wicket is an alternative to JSF that is easier to learn. Weld comes with Wicket integration.
  • There are many other possibilities including about a thousand frameworks which are basically alternatives to the servlet API. Struts2 and Stripes seem like popular options. I don't find any of these kinds of frameworks very interesting or sexy, but they're usually easy to learn. It should be very relatively easy to integrate any of them with Weld.
  • A final option worth mentioning is GWT. GWT is an entirely different beast, with its own Java to JavaScript compiler. It's great for certain kind of application. We should have GWT integration for Weld available very soon.

My personal view is that you should start out by looking at either JSF and/or Wicket, unless you're truly a beginner at this, in which case start with writing some plain servlets. If these options don't suit your needs, cast a wider net.

You'll also need a persistence solution. For most people writing EE 6 applications that means JPA2. There are at least three excellent implementations of this specification to choose from, including ours. You'll probably want to use JPA2 together with Bean Validation.

Once you've got a handle on CDI, JPA2, and whatever web framework you decide to use, take a look at EJB 3.1, and the more advanced functionality it offers for integrating with data stores and messaging, and managing asynchronicity. Unfortunately, the EJB spec itself is quite hard to read, so you should probably try to find a good tutorial. Be careful, there is still a lot of information about EJB 2 out there on the web. EJB 3.1 is a quite different beast.

15 comments:
 
17. Nov 2009, 04:12 CET | Link

How come no mention of Seam 3? Or does Weld/JSF 2 already contain most of what current Seam 2/JSF 1.2 apps would need?

ReplyQuote
 
17. Nov 2009, 04:25 CET | Link
Drew Arrigoni

How is the tooling for these different beasts?

 
17. Nov 2009, 04:47 CET | Link
Matthew Lieder wrote on Nov 16, 2009 22:12:
How come no mention of Seam 3? Or does Weld/JSF 2 already contain most of what current Seam 2/JSF 1.2 apps would need?

Weld + JSF2 contains a lot of the core value of Seam2. Of course, there's still plenty left for Seam3 to do. But it's not exactly the first thing that someone new to the platform needs to learn. Especially since it doesn't exist yet ;-)

 
17. Nov 2009, 04:53 CET | Link
Drew Arrigoni wrote on Nov 16, 2009 22:25:
How is the tooling for these different beasts?

Obviously there's going to be a bit of a wait for tooling for the new EE 6 technologies. But since there's so much emphasis on type safety in a lot of the new stuff, and such a movement away from XML, you get a lot of the benefits of tooling from the compiler and IDE, without the need for special-purpose tooling.

 
17. Nov 2009, 11:55 CET | Link
Alex

Does it really make sense to start a new app on the new stack of a sophistication where Seam is appreaciated without Seam 3? Maybe you could touch on the gap between where Seam 2.2 is versus the state of the new stack. What are we missing from Seam that we depend on most: page navigation, tags, security? Is there a way to straddle the line for a few months? Sitting on the fence with Seam 2.2 and JBoss 5.1 isn't shear bliss either with the issues surrounding hot deploy and Seam. I have been able to regain hot deploy with a 5.2 beta build for xhtml pages, which makes it tolerable.

I did see another post suggesting that RichFaces 3.3 will probably get a brushup to operate under JSF2.

Thanks. I think you and colleagues are clearly on the verge of something really special.

 
17. Nov 2009, 13:41 CET | Link
Nik

Personally, I think once the SMPC, security and navigation (JSF 2 has conditional navigation but Seam2+ is still one step up) is CDI-modularized, I'll try sneaking something small into production. And hey, that will enable me to fix Seam-stuff while at work ;-)

 
17. Nov 2009, 22:57 CET | Link
defuudexx

This is really great to learn from the masters and pioneers....even a few words that you share on what path to take is worth more than a book .....I hope to always get nice guidelines from u....

 
18. Nov 2009, 04:25 CET | Link
Alex wrote on Nov 17, 2009 05:55:
Does it really make sense to start a new app on the new stack of a sophistication where Seam is appreaciated without Seam 3? Maybe you could touch on the gap between where Seam 2.2 is versus the state of the new stack. What are we missing from Seam that we depend on most: page navigation, tags, security?

Well, here's an overview of what we do and don't have:

What we do have:

  • the basic CDI bean model, with scopes, dependency injection, lifecycle callbacks, interceptors, decorators and modularity
  • request, session, conversation and application contexts
  • Unified EL-based integration with JSF and JSP
  • events
  • support for JavaBeans, EJBs and producers
  • basic Ajax support in JSF2
  • support for GET requests, page parameters and conditional navigation rules in JSF2
  • integration between Bean Validation and JSF2
  • Asynchronous methods in EJB3

That's more than enough to build some very interesting applications.

What we don't have yet:

  • support in JBoss Tools
  • a tool like seam-gen for CRUD applications
  • Seam Security
  • conversation-scoped persistence contexts
  • transaction and persistence context management outside Java EE
  • jBPM integration and the business process context
  • a stateful navigation model (jBPM pageflows)
  • XML-based bean configuration
  • natural conversation ids
  • nested conversations
  • workspace management
  • EntityHome and EntityQuery objects
  • JMS message sending ease-of-use
  • internationalization and themes
  • PDF, Excel, RSS, email and Seam Text support
  • Seam Remoting
  • Drools integration
  • GWT integration
  • Hibernate integration
  • Spring and Guice integration

Now, obviously, even though some of the things on the don't have list look like showstoppers, many of them aren't. Some of those things are even more like interesting experiments that I'm not sure we even want to port to Seam3.

And a some of the more useful things on the don't have list are going to be easy to port across to run on CDI over the next couple of months. Some of them, you could easily implement yourself as a stopgap, using a portable extension.

But what we really need to do is get the Seam2/CDI interoperability layer into your hands, so that you can start migrating your application to CDI incrementally.

 
18. Nov 2009, 12:04 CET | Link

Hi, I recently did some analysis on J2EE/JEE spec documentation. Interesting to see, how much documentation a beginner has to keep up with. About 6000 pages spec and half of this is considered core .. more here

 
19. Nov 2009, 01:26 CET | Link

I'm having a look around at the moment with different things, and one of the current frustrations I have is the fact that all this new shiny stuff (Glassfish v3, Jee6, JBoss AS with Weld, JSF 2, EJB 3.1, JSR 299 , well I guess just JEE 6 in general) is soooo close to being ready, and yet it is all unusable together at the moment.

JBoss 5.2 Beta isn't deploying Weld Ear files without errors and doesn't support Jee 6 (EJBs in WAR files), Richfaces isn't working with JSF 2, there are problems injecting stateless beans into passivating managed beans, glassfish v3 is prone to hanging on redeploys, Netbeans with the nice JSF editor likes to freeze too often, JBoss Tools isn't JSF 2 ready and eclipse doesn't help edit xhtml files by default. This isn't meant to be a whine and I know most of this stuff is developer/beta release level at the moment and it is the cutting edge.

It's just frustrating that all this stuff is so close but not ready and the best current working standard stack is JSF 1.2, Richfaces 3.x, JPA 1, Jee5, Glassfish v2 / JBoss 5.x. Getting any of the new (dev/beta) stuff working completely is a pain right now, so I can't imagine what it would be like for someone new to JEE. I'm trying to blog some 'Intro to Weld' stuff, but can't get a working stack together to demonstrate it (except maybe Eclipse and Tomcat/Weld with no EJBs).

However, a good post, it's nice to see someone draw a line in the sand and give an informed opinion.

Also, I was looking at the EJB 3.1 spec yesterday and found it to be littered with EJB 2.1 stuff to the point that it was impossible to read. I think the problem is that it is a spec and if you are writing an EJB App Server, it probably is core. However, I think in practical terms, as a developer, the 80-20 principle probably applies. 20% of the spec is relevant or could be expressed in a document a fraction of this size.

 
19. Nov 2009, 02:22 CET | Link
all this new shiny stuff ... is soooo close to being ready, and yet it is all unusable together at the moment.

Yes, it will take a few more weeks to pull everything together into a working AS release. Both the JBoss and GlassFish teams are hard at work on this.

JBoss 5.2 Beta isn't deploying Weld Ear files without errors

On the current nightly builds, I'm deploying and running the Weld example w/o error. Not saying there aren't bugs, just that it's working at some level.

Richfaces isn't working with JSF 2, ... Netbeans with the nice JSF editor likes to freeze too often, JBoss Tools isn't JSF 2 ready

Yes it will take a little while to get all the tooling uptodate with JSF2.

Also, I was looking at the EJB 3.1 spec yesterday and found it to be littered with EJB 2.1 stuff to the point that it was impossible to read.

Yeah, that's unfortunate. The spec is overdue for reorganization. It's not as bad as the JSF spec, however, which needs to be just completely rewritten.

However, I think in practical terms, as a developer, the 80-20 principle probably applies. 20% of the spec is relevant or could be expressed in a document a fraction of this size.

That's correct.

 
19. Nov 2009, 07:50 CET | Link
Gavin King wrote on Nov 18, 2009 20:22:
Richfaces isn't working with JSF 2, ... Netbeans with the nice JSF editor likes to freeze too often, JBoss Tools isn't JSF 2 ready Yes it will take a little while to get all the tooling uptodate with JSF2.

JSF 2 support were added in M3 and even more in M4 JBoss Tools release.

Please try it out and let us know if there are some JSF 2 feature we aren't supporting properly.

i.e. M4 supports composite components in code completion and the visual rendering and openons understand the resource lookup mechanism in JSF.

 

--max

 
19. Nov 2009, 14:14 CET | Link

BTW, Max, is there some wiki-brainstorming-page where we can toss around features we'd like to see in Weld Tooling?

 
19. Nov 2009, 18:51 CET | Link

The current way is to open feature requests in JBIDE jira under the CDI component.

Feel free to create a wiki and point us to it if you prefer that approach.

 

--max

 
11. Apr 2012, 23:26 CET | Link

Are there any updates to this? I noticed the latest comment is from November 2009. How would you rewrite this blog entry now? What about frameworks like PrimeFaces and IceFaces? What's the best framework that can easily interact with JavaScript libraries like jQuery?

Post Comment