Tag: Java EE

  • Job Scheduling – The Timer Service

    Most non-trivial applications require at least some asynchronous processing but direct use of the thread library is not allowed in a JEE container environment. To get around this limitation EJB 2.1 introduced a timer service which, although functional, wasn’t very feature rich. This has finally been fixed in EJB 3.1 which brings a new, annotation driven,…

  • Getting Started with JEE 6 – Choices, Choices – Picking an Alternative

    In the previous article we looked at how we can use the CDI qualifier system to pick which one of multiple possible implementations should be used when an injection takes place. In this article I show you how to decide what gets injected at runtime rather than at build time.

  • Getting Started with JEE 6 – CDI Qualifiers

    In the last article we developed an application that had two alternative implementations of an EJB based QuoteService which unfortunately ran aground because CDI couldn’t choose which of our implementation to use. In this article I’ll discuss how to let the system know which implementation to use by using CDI qualifiers.

  • Getting Started with JEE 6 – Multiple Implementations of an EJB

    In the previous part of this series we developed an application that contained a simple no interface EJB which fed quotes to a QuoteBean which, in turn, supplied them to the JSF page. In this part I’ll modify the QuoteService to make it an interface and then provide two different implementations of that interface.

  • Getting Started with JEE 6 – Creating an EJB

    In the previous part we created a simple little application that comprised just a single bean and a JSF page. The page called the bean and asked for a quote which was then displayed. Under the hood though there was a lot of stuff going on and it’s best to have at least an idea…

  • 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…

  • 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…

  • 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…

  • 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.

  • 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…

  • JPA 2 Eager Fetching on a Collection

    Quick little JPA 2 issue that I faced today that I’m sure many other people have run into especially when starting out. The problem was and error message such as the one shown below when attempting to display the contents of a Set of other entities in a JSF page

  • 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.