Getting Started with JEE 6 – First Code

Now that we have created the project it’s time to throw caution to the wind and just start writing some code! Right click on the example.simpleproject node under Source Packages and select new… then Java Class. Call the class QuoteBean or some such – it has been common to call classes such as this SomethingBean but that practice seems to be falling by the wayside as so many classed now follow bean patterns.Continue reading

Getting Started with JEE 6 – Creating a New Project

This short series of articles covers some of the basics of working with Java EE 6 (JEE6) and in particular JSF 2.0 and CDI (JSR 299 Context and Dependency Injection). JSF 2.0 and CDI bring some fantastic new functionality to the table but at the same time they also replicate a lot of existing ideas and bring them all under one roof. Unfortunately because all of the existing ideas are still used and available in containers we have ended up with a confusing mish-mash of annotations and configurations that mostly work together but have some gotchas to watch out for.Continue reading

Local transaction already has 1 non-XA Resource

While developing a bit of functionality that transferred data from one database to another in my current JEE 6 web application I came upon the exception below. Surprisingly for exceptions from deep within system this one is actually quite informative if you understand what it’s saying: the key is knowing that XA means distributed transaction. Transactions can be one of two types either local or non-distributed or distributed. A local transaction is what you are normally doing, the transaction involves a single resource (a database connection for example) which is doing all the transactional work itself.Continue reading

Creating a Connection Pool in GlassFish 3.1

Database connection pools are by far the simplest and quickest way to get a database connection from a JEE application. This article describes how to set up a new connection pool in GlassFish 3.1. Version 3.0.x of GlassFish used configuration screens that were very similar but in a slightly different place in the menu.Continue reading

JEE 6 and Dates

I’ve been having some problems with dates recently in the application I’m currently working on. I need to be able to specify a date that indicates when a particular piece of information becomes valid. Sounds simple enough, yes? I thought so until I actually came to try and implement it. The problem I faced stemmed from the fact that JSF and JEE in general make some assumptions about time that can make your head spin.Continue reading

JSF 2.0 Resouce Handling

One of the new features I really like in JSF 2.0 is the resource handling system that has been added. When I first heard about it I wondered why they had bothered but once I’d been using it for a while I realized what a good idea it is.Continue reading