David R. Heffelfinger

  Ensode Technology, LLC


GlassFish Book Giveaway Winners

Java EE 6 with GlassFish 3 Application Server

Over the last few weeks, we have been having a giveaway for my latest book, Java EE 6 with GlassFish Application Server.

The giveaway is now over, and we have randomly selected three winners.

Without further ado, here are the winners:

Congratulations to all the winners!

Obtaining a copy of the book

If you would like a copy of the book and you are not one of our lucky winners, I encourage you to purchase it directly from Packt Publishing.

Thanks to everybody that participated and congratulations once again to our winners!


Win a Free Copy of Java EE 6 with GlassFish 3 Application Server

Java EE 6 with GlassFish 3 Application Server

As some of you know, my latest book, Java EE 6 with GlassFish Application Server, was recently published by Packt Publishing.

Packt Publishing was kind enough to offer me three copies of the book to give away.

About the Book

The book covers all aspects of Java EE 6 development using GlassFish 3, some of the topics include:

  • JavaServer Faces (JSF) 2.0
  • Java Persistence API (JPA) 2.0
  • Enterprise JavaBeans (EJB) 3.1
  • Contexts and Dependency Injection (CDI) 1.0
  • Java API for RESTful Web Services (JAX-RS) 1.1
  • Java API for XML Web Services (JAX-WS) 2.1
  • Servlet 3.0

How to Enter for a Chance to Win

All you have to do is answer one (or both) of the following questions in a comment below:

  1. What would you like to learn from the book?
  2. Why would you like to win a copy of the book?

If you prefer a certain book format and you are a USA or Europe resident, please note that in your comment as well, and we'll do our best to accommodate you (paperbacks are only available for USA and Europe residents).

Giveaway Details

The duration of this giveaway is 20 days. The giveaway ends on Monday, September 6th, 2010 after which comments will be disabled on this post.

Three winners will be randomly selected to win a copy of  Java EE with GlassFish 3 application Server, authored by David Heffelfinger (yours truly) and published by Packt Publishing. Make sure you use a valid email address in the comments so that we can contact you if you win. Winners will be announced on Friday, September 10th, 2010 and also contacted via email. Good luck!

Update: The giveaway is now over. Thanks to all that participated. Winners will be announced this Friday, September 10th.


Java DB / Apache Derby Upgraded

Like I mentioned in My very first entry in this blog, I am running Apache Roller to run this blog.

I'm using GlassFish and Java DB, which isn't much more than a rebranded version of Apache Derby.

The setup was working OK, but every now and then Roller would throw some weird errors, valid URLs would 404, and sometimes it would go completely "out to lunch", generating error 500's.

I started looking through the GlassFish logs and noticed some entries similar to the following:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.apache.derby.client.net.NetCursor.findExtdtaData(Unknown Source)
at org.apache.derby.client.net.NetCursor.getClobColumn_(Unknown Source)
at org.apache.derby.client.am.Cursor.getString(Unknown Source)

I googled around and found out this issue is caused by a bug on JavaDB/Derby version and earlier. I happened to be running I just upgraded to version of JavaDB/Derby. I expect the weird errors I've been seeing to go away now.


Project WebSynergy First Impressions

After blogging about my OpenPortal First Impressions, I was contacted by Eduardo Pelegrí-Llopart, he suggested I take a look at Project WebSynergy, a joint venture between Sun Microsystems and Liferay. Project WebSynergy includes code from Liferay and OpenPortal.

I downloaded it and took it for a spin, here is what I found:

Out of the box, it is much more aesthetically pleasing than OpenPortal

Project WebSynergy Screenshot

Tabs can be created directly from the user interface.

Project Synergy Add Page

Similarly, hovering over a tab results in a little red icon showing up, clicking on it allows the user to delete a tab: Project WebSynergy delete tab

Of course a confirmation dialog asks the user to confirm the deletion of the tab.

Project WebSynergy delete tab confirmation

Project WebSynergy certainly seems to include a lot of built in functionality that may have to be manually coded when using OpenPortal. The advantages I found for OpenPortal was the tight integration it provided with GlassFish and NetBeans.

Although Project WebSynergy is not available from the GlassFish Update center, it can be downloaded bundled with GlassFish. That is what I did to try it out, I'm not sure how easy it would be to deploy it on an existing GlassFish installation.

As of NetBeans, the portlet plugins available in the NetBeans Plugin Manager do not integrate with Project WebSynergy, however, the NetBeans PortalPack 3.0 (milestone 2 is the latest available at the time of writing) does. Simply downloading the plugins from the NetBeans Portal Pack page and installing them on NetBeans (I tried on NB 6.5 RC2) provides the same integration that is provided with OpenPortal by the portlet plugins in the NetBeans Plugin Manager.

All in all my overall impression of Project WebSynergy is favorable, my one concern is that neither the NetBeans plugins nor Project WebSynergy itself are officially released, therefore they cannot be considered stable yet. In my admittedly simple tests they worked fine, but I can't be sure there aren't any issues waiting to be discovered if/when we start using it for real work.


Installing Apache Roller in GlassFish

For a while i've had a a blog in JRoller. I've been wanting to move my blog to my own domain, but due to lack of time and other commitments I hadn't been able to do it. Well today I finally did it.
I figured a good first entry would be to talk about how to get Apache Roller going under GlassFish, which happens to be my Java EE server of choice, and the one that powers my site. GlassFish comes with the JavaDB RDBMS "out of the box", which is what I'm using in this Roller installation.

After downloading Roller, the first thing we need to do is to create the database that Roller will use. In JavaDB, we can accomplish this with the ij utility.

In ij, we need to issue the following commands to create the database.

connect 'jdbc:derby://localhost:1527/roller;create=true';

Then we need to add a user to the database:

CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.admin','noneofyourbusiness');

The above command creates a user with username of "admin" and password of "noneofyourbusiness". The username and password can be modified as appropriate.

We then need to grant full access to our admin user:

CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.fullAccessUsers','admin');

We are done with the database creation.

Now we need to create a GlassFish connection pool and JDBC Resource for our new database, this can be accomplished easily with the asadmin tool:

asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --property user=admin:password=noneofyourbusiness:databaseName=roller rollerConnectionPool

The value of the databaseName property must match the name we gave our database in the first step.

To create the datasource/JDBC resource, we need to issue the following asadmin command:

asadmin create-jdbc-resource --connectionpoolid rollerConnectionPool jdbc/rollerdb

It is important to use the JNDI name of jdbc/rollerdb, otherwise the roller code won't be able to find the datasource.

After we have created the connection pool and datasource, we need to create a file called roller-custom.properties with the following content:


And copy it to the lib/classes folder of on the GlassFish domain we are using.

At this point we are ready to deploy Roller, just deploy it as usual and it should "just work".

Good Luck.


« May 2018

© David R. Heffelfinger