2013-07-21 10:13:20

I am currently learning more about the Java Enterprise Edition - although I already know several aspects (like MVC, JPA etc) through years of developing Java web applications with both Grails and Java SE, I have not yet explored the more complex world of J2EE.

This series of articles details my learning experience - it is not (yet) structured, but may serve as an informational guide about the obstacles and insights encountered on the way.

Lesson 1: this is complex.

I am starting with the new First Cup of J2EE tutorial. This tutorial is written for users of the Netbeans IDE - and I tried to adapt it for the Intellij IDEA IDE, but this is more problematic than it seems. For while Intellij also offers an option to start the Glassfish server, the specific steps to configure the deployment URL are non-obvious (at least, if all you got is the tutorial information). Creating a new J2EE project also means you get to select many options whose consequences will be entirely unclear (if you are just starting). So for now, I have decided to use the Netbeans IDE.

Baby steps: Chapter 1 of the First Cup tutorial

Following the tutorial pdf, it was easy to configure my Glassfish install as the one to be used by the IDE (you have to close the start screen to see the "servers" tab - just searching in the menu bar will get you nowhere)

First snag: Tutorial and Netbeans diverge as the IDE does not react to "Open Update Center". Solution: access the Glassfish admin console in the browser: http://localhost:4848/common/index.jsf - there you can find the tutorial updates.
But actually installing the update is more difficult: you have to first stop the currently running domain before you can continue.

How to stop a domain from the Glassfish admin webgui? There is only an option for "stop server" ... which does what it says.

"To update components, first stop the domain, then use the updatetool utility or the pkg command." it says in on the admin web page. So, the web gui (which takes about 20-30 seconds for each click in the update section as it refreshes the component list remotely...) cannot actually install updates. And stopping a domain seems to be the same as stopping the whole server, at least if you only got the default domain1 running.

http://docs.oracle.com/cd/E26576_01/doc.312/e24928/extending-updating.htm#ghjlp shows how to proceed (Note: as of this moment, docs.oracle.com only lists Glassfish 3.1 and not the current v4 in its docs.)

asadmin stop-domain
cd $GLASSFISH_HOME
pkg list -u
pkg install javaee-firstcup-tutorial
pkg install javaee-tutorial

So, now the tutorial is updated and it looks like I am ready to start with chapter 2.