When building integrations with JBoss ESB you naturally need to interact with other systems via notification gateways other than messaging queues. It could be that you need to enrich data from a WS-SOAP service or just put data into a file in a specific directory. These addresses and location often need to be different depending on which environment you are running in.
While testing your JBoss service it can be very handy to use DefaultDS as your data source. However you will probably not want to hardcode this JNDI name into your code, jboss-server.xml, web.xml or persistence.xml (depending on service you write). There you want to use your own "MyAppDS" JNDI name. So wouldn't it be sweet to be able to bind two different JNDI names to the same datasource ?
It is possible and quite simple however I could not really find any good example while Googling the problem. So here is a short description how I solved my problem.