Tuesday, January 22, 2008

Some notes on GlassFish v2, JDK6 and JDBC4 (PostgreSQL)

These are my today experiences (really my today headaches) porting a couple of applications from GlassFish v1 running with JDK5 to GlassFish v2 running with JDK6.

The applications was developed with NetBeans 5 and consist of a couple of EJB modules and a couple of web applications using the VisualWebPack in the NetBeans 5 (JSF).

First, I downloaded and installed JDK6 and GlassFish v2.

Before deploying the application you must take into account that my JDBC driver in GF1 (running JDK5) was a JDBC3 PostgreSQL driver. This driver is compiled for JDK5, thus I need to download and install (in the GF2 server) the JDBC4 version (not completed yet).

Next, I have created some database resources using the JDBC4 drivers. This works but generates a lot of warnings when application runs. To avoid them you need to put this option in your resources JDBC30DataSource=true.

Finally I have developed the applications. I this step I found strange behaviors and some server crashing problems. After trying 1000 thing I found that the problem was in a hyperlink in a JSF page. For an unknown reason, changing the hyperlink by a button (mantaining the same action) resolve the problem.

If you are working, like me, with PostgreSQL I would like to point this link about sequences:


cayhorstmann said...

Could you please explain exactly where you set that property? (I tried the asadmin set command in https://glassfish.dev.java.net/issues/show_bug.cgi?id=2779 and it didn't work.) Also, what version of GlassFish are you running?



Antonio Santiago said...

currently I use GF2.
Instead of use: AS_INSTALL_DIR/bin/asadmin set domain.resources.jdbc-connection-pool.

I put the property via web console. When define your JDBC Resource create a new property: JDBC30DataSource.