SOLVED. So, for future reference, you need to explicitly include the javaee.jar file from the application server's lib directory in the classpath. To do that, just add it as a library to your netbeans project.
While we're at it, glassfish 2 comes with ant 1.6, which cannot run junit 4 test suites. This is solved by manually installing ant 1.7, and setting the ANT_HOME environment variable to point to it. Hudson picks the new ant up and runs is perfectly.
[Message sent by forum member 'mich_barsinai' (mich_barsinai)]
http://forums.java.net/jive/thread.jspa?messageID=330258