Sunday, January 27, 2008

OSX Leopard + Glassfish Read This

Ok, after many frustrating hours/days, I finally found a thread that fixed this problem:

when starting glassfish, it fails when it attempts to initialize the AMX and JMX stuff. You get a connection refused because the jmx stuff is trying to connect to 169.254.x.x

I guess leopard uses this for it's wireless stuff now (the ip) and no amount of altering of network settings will work. I even tried routing all traffic to localhost from 169... No dice.

The fix: in the /domains/domain1/config/domain.xml file, edit the

jmx-connector accept-all="false" address="localhost" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false"

line. By default, the enabled="true" is set. change this to enabled="false" You lose the ability to administer glassfish remotely, but at least it will start.

I'm sure glassfish will work on a patch, eventually.

Friday, January 25, 2008

EJB3 - Temporal Types

With EJB3 (and jpa, etc) dates can be a little confusing. If you need just the date (no time), use @Temporal(TemporalType.DATE) and you will only get thet date. The time will be zeroed out.

If you want the date with the time, use @TemporalType(TemporalType.TIMESTAMP) and you will get both the date and time.

In both cases, still use java.util.Date or java.util.Calendar (I use java.util.Date). With the eclipse ide, when reverse engineering tables to entities, by default it will plug in java.util.Date with the TemporalType.DATE and you lose the time.

Anyway, hope this helps!