Looking at the jboss-app_4_0.dtd file, it appears that one can embed a Hibernate archive and a service within an ear file (and reference them via a jboss-app.xml file), but one cannot embed a *-ds.xml. So it looks you you will have to create a sar file, though you could possibly place only the *-ds.xml file in it and then embed the sar within the ear. I haven't tried this, but if it works, let me know.
Put a jboss-app.xml file into META-INF of your ear that looks somewhat like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <module> <service>META-INF/datasources/mysql-ds.xml</service> </module> </jboss-app>
This will deploy your -ds.xml and -service.xml files. You will have to adjust the path to the files though, depending on where you put them inside your archive ;-)
Thanks for your replies.
I choose the "boss-app.xml"-alternative and it is working great.