I want to configure a XA Datasource for a Derby database in a JBoss-22.214.171.12400429-M3 server. I have used the Web Admin Interface to create the atached file "jdbc-ds.xml". The datasource is successfully bound to "java:jdbc/__default". Here is the first think which confuses me. I set the JNDI name to "jdbc/__default" but the console says that the datasource is bound to my JNDI name prefixed with "java:". Can I lookup the datasource by the name "java:jdbc/__default" or "jdbc/__default"? What is the reason for the prefix?
Then I want to access the datasource inside of a bean, deployed on the server, with the following code:
private static final String JNDI_NAME_XA = "jdbc/__default";
@Resource(name = JNDI_NAME_XA)
private DataSource _ds_xa;
When the server trys to deploy the bean, the console output says "mapped-name is required for jdbc/__default of deployment PlainDataSourceTestBean" and the bean is not deployed. I also tryed the JNDI name "java:jdbc/__default" with the same result, although a few lines above the console output says "Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/__default' to JNDI name 'java:jdbc/__default'".
Which JNDI name do i really have to use, and do I have do do some more configuration?