users@glassfish.java.net

Re: domain.xml not present in 3.1-SNAPSHOT builds of glassfish-embedded-all?

From: <glassfish_at_javadesktop.org>
Date: Wed, 19 May 2010 11:14:57 PDT

Yes, you are quite right. My deepest apologies. I don't think that my initial download of the jar completed correctly.

What I'm trying to do is to get unit testing working. The blocking issue was--and continues to be, in any build other than 3.0.1b12, oddly enough--data source creation.

I had run into all kinds of problems before: http://forums.java.net/jive/thread.jspa?messageID=395773

Then found this: http://blog.blackbit.be/?p=5

Got that approach working with glassfish-embedded-all version 3.0.1-b02.

I've attempted several times to bump this version up to 3.1-SNAPSHOT, and in all cases, Glassfish dies with an exception:

java.sql.SQLException: Error in allocating a connection. Cause: null
        at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:112)

This happens, basically, any time anyone tries to look up the connection from JNDI. I get the error from the bowels of EclipseLink, but I can also get the error by simply trying to do a regular old InitialContext lookup.

The only thing I add to the domain.xml is an H2 datasource. (H2 is the successor to HSQLDB.)

I've attached my domain.xml with the additions; it is placed in the classpath ahead of everything else.

You'll notice that I make use of the ${systemProperty} expansion facility. In my build, I supply a System property named testDatabaseDataSourceName with a value of java:global/jdbc/H2Test. The net effect is that when embedded Glassfish starts up, it creates my data source for me to an in-memory H2 implementation. Only in build 3.1-SNAPSHOT, JNDI lookups of this value apparently fail.

Again, this setup works fine with build 3.0.1-b02, and, apparently, none later.

Best,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=470526