OSX Java Update breaks PostgreSQL JDBC4
June 17th, 2009
It seems like the latest Java update from Apple breaks the JDBC4 version of the postgresql database driver.
I currently have two Grails apps doing similar things. One (by accident or luck, your call) uses postgresql-604.jdbc3 as it’s database driver. The other one uses a different driver, namely postgres-604-jdbc4.
Today I updated my installed Java on the Mac using software update.
Suddenly one of the Grails apps was broken.
.... tries to work out what has gone wrong
I got a ClassNotFound Exception while loading the driver. So I tried to figure out where the two apps differ. It turns out that the only relevant difference between the two apps (database-driver-wise) is that one uses jdbc3 and the other jdbc4.
I’m not blaming anyone, but I suspect the update broke it.
So if anyone faces the same problem while running a Grails app, there you go: Replace jdbc4 with jdbc3!
And now part of the stacktrace for googleability:
Starting integration tests ...
Cannot load JDBC driver class 'org.postgresql.Driver'
java.lang.ClassNotFoundException: org.postgresql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:45)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
Addendum
And yes, I’m aware of the fact that the JVM on OSX is 1.5. But previously it used to work, so I figured this might still be of some use to some people. Maybe JDBC4 was a bad idea all along the way, however.
Leave a Reply
You can use Textile markup in your comments!