GlassFish 3.1 embedded and Java EE 6 DataSource definition
I have been able to successfully define a datasource using the new Java EE 6 features, defining it in web.xml using a data-source node. However, I would like this application to be compatible with other servers that do not implement Java EE 6 yet, and that complain that this node is not allowed in web.xml.
So my question would be, is it possible to define this data-source node in another file that is not web.xml? I tried adding application.xml to META-INF but it is being ignored.
I have also tried adding it to sun-web.xml but it seems to be ignored there, as all I get is the same JNDI name not bound that I get if I define nothing.
I know mixing servlet versions is not a good thing, but I could not find any other descriptor to get GlassFish embedded to define a datasource, all the other embeeded containers have their own custom descriptors to do that, so I'm simply trying to get the application to be compatible with all the containers.