Thursday Jan 21, 2010

Who Am I?

Ed Ort

I'm a Senior Staff Information Engineer at Sun. That's a fancy title that means I write and do a number of other things related to technical communication for the Sun Developer Network. When I wear my writer hat, I write technical articles that appear on and After a long career at IBM, where I focused on relational database technologies and programming languages, I came to Sun and turned my attention to Java technology.

Besides writing, I also host Deep Dives. These are a series of videos where I interact with technical experts to explore leading edge Java tools and technologies. I've also done a number of audio podcasts on technology topics.

And I manage the Enterprise Java Technologies Tech Tips blog. Here you'll find tips and techniques on a wide range of Enterprise Java technology topics.

When I'm not writing, hosting videos, handling Tech Tip blogs, or writing in my own blog, I'm usually hiking or jogging in the mountains that surround Las Vegas, Nevada. Ed Ort

Friday Dec 11, 2009

Enterprise Tech Tip: DataSource Resource Definition in Java EE 6

Java EE 6 has a wide variety of new features that makes enterprise and web application development a lot easier. I covered many of these features in the article Introducing the Java EE 6 Platform. However, one of the areas of improvement in Java EE 6 that I didn't cover in that article is datasource resource definition.

If you've accessed relational databases through the JDBC API, you know all about DataSource objects. For those of you who aren't familiar with DataSource objects, they're Java objects that identify and describe real-world data sources such as relational databases. To access a datasource, you need to define a DataSource object and register it with the Java Naming and Directory Interface (JNDI) naming service. An application can then use the JNDI API to access that DataSource object, which can then be used to connect to the datasource it represents.

Prior to Java EE 6, you could create a DataSource object only through vendor-specific mechanisms, such as commands. However, Java EE 6 makes datasource definition more flexible. It introduces a new datasource definition resource that you can declare portably for database connectivity across any Java EE 6-compatible application server. You can declare datasource definitions either through annotations or through the use of deployment descriptors.

Jagadish Ramu, an engineer in the GlassFish Application Server team, has written a very nice Tech Tip that describes this new capability in more detail and shows code examples that demonstrate datasource definition using annotations and deployment descriptors. The tip also includes a sample application that demonstrates the use of these features. See the tip DataSource Resource Definition in Java EE 6.

Thursday Dec 10, 2009

Java EE 6 and GlassFish v3 Now Available

Today Sun announced the general availability of Java Platform, Enterprise Edition (Java EE) 6 and GlassFish v3. As many of you know, Java EE 5 made it significantly easier to develop web and enterprise applications. However, Java EE 6 pushes the usability envelope even further, adding ease of use improvements in many areas of the platform. For example, you can now use annotations to define web components such as servlets and servlet filters. In addition, Java EE application packaging requirements are much simpler. For example, you can add an enterprise bean directly to a web archive (WAR) file. You no longer need to package an enterprise bean in a Java archive (JAR) file and then put the JAR file in an enterprise archive (EAR) file.

Beyond those improvements, Java EE 6 adds many new features that make the platform more flexible and extensible. Java EE 6 introduces the concept of profiles, configurations of the platform that are designed for specific classes of applications. The first of these profiles, the Web Profile, is now available. It offers a subset of the Java EE platform designed for web application development.

On the extensibility front, Java EE 6 includes more extensibility points and more service provider interfaces than ever before. This allows you to plug in technologies — even frameworks — in your Java EE 6 implementations in a standard way. And with new features such as web fragments, Java EE 6 modularizes deployment descriptors, something that enables web frameworks to self-register, making it easy to incorporate and configure them in an application.

GlassFish v3 is a lightweight, flexible, and open-source application server that is the reference implementation for Java EE 6. But it's much more than that. It also offers a wide range of new productivity features, such as a modular runtime based on OSGi, that makes for extremely fast startup, efficient memory use, and runtime performance. GlassFish v3 also supports a deploy-on-save feature, such that when you update an application and save the changes in an enabled IDE such as NetBeans 6.8, the application is automatically redeployed. Many other enhancements, such as native support for scripting languages and frameworks like JRuby on Rails, make GlassFish v3 an ideal application server for web and enterprise applications.

Learn more about Java EE 6 in the article Introducing the Java EE 6 Platform. Learn more about GlassFish v3 at the GlassFish Community site and The Aquarium blog. Download GlassFish v3.

Monday Nov 30, 2009

Enterprise Tech Tip: Asynchronous Support in Servlet 3.0

The next release of the Servlet API, Servlet 3.0, which is part of the Java EE 6 Platform, adds support for asynchronous processing. That good news for developers who are working on applications that require long-lived client connections with a servlet. A good example of that kind of application is a chat application.

You can learn about some of the key features of this support such as new annotation attributes — yes, Servlet 3.0 now supports the use of annotations as an alternative to deployment descriptors — new classes, such as the AsyncContext class that provides the execution context for an asynchronous operation, and new servlet request methods, such as startAsync() for submitting an asynchronous request.

You can learn more about this support in Rajiv Mordani's Tech Tip Asynchronous Support in Servlet 3.0. Rajiv is the specification lead for Servlet 3.0.

Monday Nov 16, 2009

Enterprise Tech Tip: POST-REDIRECT-GET and JSF 2.0

JavaServer Faces co-spec lead, Ed Burns, is in the process of writing a follow up to his popular book JavaServer Faces: The Complete Reference. The new book,co-written with Neil Griffin, is titled JavaServer Faces 2.0, The Complete Reference. It's chock full of excellent tutorials about the latest version of JavaServer Faces (JSF) technology, JSF 2.0.

You can get a sneak peek into one of these tutorials, a tutorial that focuses on support in JSF 2.0 that makes it much easier to implement the POST-REDIRECT-GET pattern, or PRG for short. If you're not familiar with the PRG pattern, in short, it's a pattern described by Michael Jouravlev, in an August 2004 article titled Redirect After Post. In the article, Jouravlev described a problem that many web applications present, as follows:

All interactive programs provide two basic functions: obtaining user input and displaying the results. Web applications implement this behavior using two HTTP methods: POST and GET respectively. This simple protocol gets broken when an application returns a web page in response to a POST request. Peculiarities of the POST method combined with idiosyncrasies of different browsers often lead to an unpleasant user experience and may produce an incorrect state of the server application.

To address the problem, Jouravlev described a technique that he called POST-REDIRECT-GET, or the PRG pattern for short. The rules of the pattern are as follows:

  • Never show pages in response to POST.
  • Always load pages using GET.
  • Navigate from POST to GET using REDIRECT.

Burns says that previous versions of JSF technology violated the first of these rules by using POST for every page navigation. In navigating from one page to another in a JSF-enabled application, the JSF framework forwarded a POST request through the Servlet API's RequestDispatcher.forward( ) method. This caused a new Faces page to be rendered and returned to the browser in response to the postback request. However, thanks to a JSF contribution from the Seam team at JBoss, it is now much easier to do PRG with JSF 2.0.

If you want to learn more about this topic, read Burns's Tech Tip POST-REDIRECT-GET and JSF 2.0 The content of the tip is an adaptation of a section on PRG and JSF 2.0 in Burns's upcoming book.

Friday Oct 30, 2009

Enterprise Tech Tip: Using CDI and Dependency Injection for Java in a JSF 2.0 Application

The next release of the enterprise Java platform, Java EE 6 includes a number of powerful new technologies and well as significant enhancements to existing technologies. Two of the new technologies are JSR 299: Contexts and Dependency Injection (CDI) (referred to in earlier times as Web Beans) and JSR 330: Dependency Injection For Java. One of the significantly enhanced technologies is JSR 314: JavaServer Faces 2.0.

CDI defines a set of services for the Java EE environment that makes applications much easier to develop. Perhaps most significantly, CDI unifies and simplifies the Enterprise JavaBeans (EJB) and JavaServer Faces (JSF) programming models. It allows enterprise beans to act as managed beans in a JSF application.

Until now there has not been a standard approach for annotation-based dependency injection. Dependency Injection For Java changes that by introducing a standard set of annotations that can be used for dependency injection.

If you're involved with creating user interfaces (UIs) for web applications, you're probably familiar with JavaServer Faces. It's a technology that provides a server-side component framework that is designed to simplify the development of UIs for Java EE applications. The latest release of the technology, JSR 314: JavaServer Faces 2.0, makes UI development for Java EE applications even easier through support for annotations and the addition of new features such as Facelets and composite components.

You can get a good idea of how these technologies simplify web application development by reading the Tech Tip Using CDI and Dependency Injection for Java in a JSF 2.0 Application, written by Roger Kitain, the JavaServer Faces co-specification lead. Roger presents a JSF 2.0 application and shows in the source code where CDI components and Dependency Injection for Java annotations play a role.

Tuesday Sep 29, 2009

Deep Dive: JDK 7 With Danny Coward

A few months ago, I had a chance to sit down with Danny Coward, the Chief Architect for Client Software at Sun Microsystems, to examine some of the new and cool features in the next release of the Java Development Kit, JDK 7. Some of these features focus on modularizing the JDK, supporting non-Java languages at the VM level, and making developers more productive through various small changes to the Java languages. Danny backed up this discussion with some code examples and demonstrations. It was an educational and enjoyable session. I hope you agree.

Note that the content of this session reflects the state of the project at the time the Deep Dive was taped. Please check the JDK 7 Features project site for the latest information about JDK 7.

Enterprise Tech Tip: Locking and Concurrency in Java Persistence 2.0

One of the real success stories behind Java EE 5 is the Java Persistence API, know informally as JPA. The technology has been widely adopted and is recognized as the enterprise standard for Object/Relational (O/R) persistence.

However, one of the shortcomings of JPA 1.0 is that the only type of locking it supports is optimistic locking. Recall that locking is a technique for handling database transaction concurrency. When two or more database transactions concurrently access the same data, locking is used to ensure that only one transaction at a time can change the data.

There are generally two locking approaches: optimistic and pessimistic. Optimistic locking assumes that there will be infrequent conflicts between concurrent transactions, that is, they won't often try to read and change the same data at the same time. In optimistic locking, the objective is to give concurrent transactions a lot of freedom to process simultaneously, but to detect and prevent collisions. Two transactions can access the same data simultaneously. However, to prevent collisions, a check is made to detect any changes made to the data since the data was last read.

Pessimistic locking assumes that transactions will frequently collide. In pessimistic locking, a transaction that reads the data locks it. Another transaction cannot change the data until the first transaction commits the read.

The next release of JPA, JPA 2.0, which will be offered as part of Java EE 6, adds support for pessimistic locking. Using JPA 2.0, you can lock an entity either optimistically or pessimistically, depending on how often you think transactions will collide.

To learn about the new locking support in JPA 2.0, see the Tech Tip Locking and Concurrency in Java Persistence 2.0 by Carol McDonald.

Tuesday Jul 07, 2009

New JDK 7 Feature: Support for Dynamically Typed Languages in the Java Virtual Machine

Over the years, the Java virtual machine (JVM) has been host to a growing number of languages. Increasingly, JVM implementations of dynamic languages are becoming available, such as JRuby, an implementation of the Ruby programming language, Jython, an implementation of the Python programming language, and the Groovy scripting language.

However, developers of these dynamic languages have faced a troublesome obstacle. When developers write engines for dynamically typed languages that run in the JVM, they have to satisfy the requirements of the Java bytecode that the JVM executes. Until now, that bytecode has been designed exclusively for statically typed languages. This design has been especially painful for developers when generating bytecodes for method invocations.

But help is on the way. JSR 292: Supporting Dynamically Typed Languages on the Java Platform, which is being implemented in JDK 7, introduces a new Java bytecode instruction for the JVM, invokedynamic, and a new method linkage mechanism based on method handles.

Learn more about this new JDK 7 feature in the article Support for Dynamically Typed Languages in the Java Virtual Machine.

Friday Jun 26, 2009

Enterprise Tech Tip: A Sampling of EJB 3.1

Enterprise JavaBeans (EJB) technology has taken a number of knocks in the past. When it was first introduced some, perhaps many, cried that it was too complicated, with a lot of programming overhead that made the technology needlessly difficult to use.

Over time things have improved dramatically. Features such as annotations in EJB 3.0 made the technology much, much easier to use. Those ease-of-use advancements continue with the upcoming release of EJB 3.1, which will be included in Java Platform, Enterprise Edition (Java EE) 6. A preview version of Java EE 6 is currently available for download. The preview version includes a nearly complete implementation of EJB 3.1

If you want to learn about some of the new, cool features in EJB 3.1, see the Tech Tip, A Sampling of EJB 3.1, written by Ken Saks, the EJB 3.1 Specifical Lead.

Friday Jun 12, 2009

Enterprise Tech Tip: A Common Ant Build File for Metro-Based Services and Clients

If you're like most developers, you're always looking for shortcuts that simplify developing and testing code. In this Tech Tip, Metro architect Harold Carr describes just such a helpful shortcut -- a common ant build file that simplifies the task of building and testing Metro-based services. The build file can builds a service from a WSDL description or from a Java class annotated with @WebService. It then either creates a WAR file and deploys the WAR file to a container or it invokes the Endpoint.publish() method to publish the web service endpoint using the HTTP server built into the Java platform.

Read about it in the tip A Common Ant Build File for Metro-Based Services and Clients.

Deep Dive: MySQL Tips For Java Developers

MySQL is the world's most popular open-source database, and there are a lot of Java developers who use MySQL databases in their applications. In this Deep Dive, Mark Matthews, architect for Enterprise Tools Team at Sun Microsystems, demonstrated some of the techniques that can help Java developers get more out of their applications that use MySQL.

Mark has a lot of experience regarding the use of MySQL and Java technologies. Aside from being an architect for MySQL tools at Sun, Mark is the original developer and maintainer of Connector/J, the MySQL JDBC driver.

Mark covered a number of MySQL tips for Java developers including some lesser known configuration options, connection pool settings, and some special MySQL language elements such as ON DUPLICATE KEY UPDATE.

Notes From the 2009 JavaOne Conference

The numbers were a bit down from previous years and perhaps there was a little less buzz, but I found this year's JavaOne Conference to be as interesting and fun as ever. As always, I was part of the Sun Developer Network team that covered the general and technical sessions for the conference web site. I was also host for a number of "Man/Woman on the Street" interviews with conference attendees.

I found the sessions to be uniformly excellent. It seemed that the quality of the presenters and their demonstrations at these sessions was exceptionally high. I hope those of you who went to the conference were equally impressed with the sessions. If you didn't get a chance to attend the conference, you can view video replays of the general sessions.

You can find all of the articles covering the sessions here. I covered the following sessions:

I also had the opportunity to cover the general session for CommunityOne West, a conference focused on communities and open source. CommunityOne West started the day before JavaOne. Cloud computing and a new release of OpenSolaris were the stars of that session. BTW, if you're into cloud computing, there are a lot of good cloud-related sessions that my SDN teammates covered during the JavaOne conference. These include:

Also see the new Sun Cloud Developer Tools site.

You can find a great wrap-up of the conference here. As the wrap-up notes, this may be the final JavaOne Conference. I've had the pleasure to attend the last 10 of them. Covering these conferences always required a lot of preparation work and a goodly amount of toil and sweat. But I always found them educational, even exhilarating. They gave me a chance to learn, a chance to share ideas, and a chance to meet some of the most interesting folks on the planet -- the Java community.

Thursday Apr 30, 2009

Deep Dive: Sun GlassFish Web Space Server 10.0

At the 2008 JavaOne Conference, Sun made an exciting announcement regarding a collaboration agreement it reached with the Liferay open portal community. Both companies agreed to share code and release products from a common codebase. Sun GlassFish Web Space Server is an outgrowth of that common codebase, bringing together features and technologies from Liferay as well as Sun's OpenPortal communities.

In this Deep Dive video, James Falkner, Sun's Product Architect for portal technologies, demonstrates many of the features that Sun GlassFish Web Space Server offers for administrators, developers, and end users. Along the way, he demonstrates some cool features such as hooking portlet events together graphically, and changing the theme for a portal page in Adobe Dreamweaver using Web Space Server's View Designer plugin.

There's so much functionality in the Web Space Server that it was difficult to fit James's demonstrations into one short video. So instead we offer multiple videos -- or a video in multiple parts. Watch it. I think you'll see that Sun GlassaFish Web Space Server 10.0 is a fun and highly functional product.

  • Part 1: Learn about the key features in Sun GlassFish Web Space Server 10.0.

Wednesday Apr 29, 2009

JavaFX App-O-Rama

Although the JavaFX platform is only a few months old -- its initial full release was in December 2009 -- people are already building some really cool applications with it. A new article, titled JavaFX App-O-Rama: Applications From the Community, highlights three community based projects that are producing cool, innovative JavaFX applications.

Here are some other good places to find cool JavaFX applications, sample programs, and demonstrations:




« July 2016