Thursday, August 30, 2007

Seam Error Messages

I've been reading JBoss Seam : Power and Simplicity Beyond Java EE (Amazon link) and working through the examples from Michael Yuan's site.

After playing with the example from Chapter 6 : A Simple Stateful Application, I decided to change the ManagerAction class from a session scoped variable to a conversation scoped variable.

I changed "@Scope(SESSION)" to "@Scope(CONVERSATION)", added a "@Begin" to the "sayHello()" method, and added "@End" to the "startOver()" method and redeployed.

I had breakpoints set inside the sayHello and startOver methods and was debugging in Eclipse Europa.  I wanted to watch the memory addresses of the ManagerAction over multiple submits to verify that different browser tabs would spawn different conversations.

The change didn't work.  I got,

14:22:29,544 FATAL [application] javax.ejb.EJBException: java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: sayHello

I decided to follow the error message's advice.  It worked -- nice error message!

I started two conversations in two browser tabs, the urls displayed differenct conversation ids, and Eclipse showed different memory addresses when I hit the breakpoints.  However, when I entered different one word names, "Bill" and "Mickey" (I was listening to DeadPod) and tried different responses to the prompt, I encountered a problem.  When I would choose the "Oops, let me go back and change" option the name would be the same in both windows.

I checked the Person object, and it was session scoped.  I removed the @Scope annotation and everything worked as expected.

Hibernate often throw nice error messages, and I'm glad to see that has been carried over to Seam.  Nice work!


Blogged with Flock

Friday, August 10, 2007

Enabling the HSQLD / Hypersonic console in JBoss 4.2.0.GA

Enabling the HSQLD / Hypersonic console in JBoss
  • Uncomment lines 16, 90 and 95-103 of hsqldb-dx.xml. The server should pick up the change to the file and reload.
  • Open up the jmx-console (http://localhost:8080/jmx-console if running locally.)
  • Click on the "service=Hypersonic" link under jboss.
  • Click the "Invoke" button under "void startDatabaseManager()" which should be the third MBean operation.

Blogged with Flock