Spring framework JNDI Configuration issue in JBOSS eap 6.1.0
<p>I have deployed a war file in Jboss eap 6.1.0 server. I am using Spring framework in my project. I have configured JNDI using two files namely sample-ds.xml(kept under JBOSS deploy folder) and dataSourceConfiguration.xml(it is part of war file and loaded by applicationContext.xml file). The dataSourceConfiguration.xml is as below:</p>

<pre><code>&lt;beans&gt;

&lt;jee:jndi-lookup id="awd"               jndi-name="CS/AWD_QA"           resource-ref="false" /&gt;


    &lt;!-- Don't change the id of the bean com.dsths.cs.awd.utils.RoutingDataSource --&gt;   
    &lt;bean id="routingDataSource" class="com.dsths.cs.awd.utils.RoutingDataSource"&gt;
        &lt;property name="targetDataSources"&gt;
            &lt;map key-type="java.lang.String"&gt;&lt;/map&gt;
        &lt;/property&gt;
    &lt;/bean&gt;
</code></pre>

<p>My sample-ds.xml is as below:</p>

<pre><code>&lt;datasources&gt;
&lt;datasource enabled="true" jndi-name="java:jboss/CS/AWD_QA" jta="true" pool-name="AWDCS" use-ccm="true" use-java-context="false"&gt;
&lt;connection-url&gt;jdbc:oracle:thin:@XXXXX:1521:AWD&lt;/connection-url&gt;
&lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;
&lt;transaction-isolation&gt;TRANSACTION_NONE&lt;/transaction-isolation&gt;
&lt;pool&gt;
&lt;min-pool-size&gt;5&lt;/min-pool-size&gt;
&lt;max-pool-size&gt;10&lt;/max-pool-size&gt;
&lt;prefill&gt;false&lt;/prefill&gt;
&lt;use-strict-min&gt;false&lt;/use-strict-min&gt;
&lt;flush-strategy&gt;FailingConnectionOnly&lt;/flush-strategy&gt;
&lt;/pool&gt;
&lt;security&gt;
    &lt;user-name&gt;sample&lt;/user-name&gt;
    &lt;password&gt;sample&lt;/password&gt;
  &lt;/security&gt;
&lt;validation&gt;
&lt;validate-on-match&gt;false&lt;/validate-on-match&gt;
&lt;background-validation&gt;false&lt;/background-validation&gt;
&lt;use-fast-fail&gt;false&lt;/use-fast-fail&gt;
&lt;exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter"/&gt;
&lt;/validation&gt;
&lt;timeout&gt;
&lt;idle-timeout-minutes&gt;15&lt;/idle-timeout-minutes&gt;
&lt;xa-resource-timeout&gt;0&lt;/xa-resource-timeout&gt;
&lt;/timeout&gt;
&lt;statement&gt;
&lt;track-statements&gt;false&lt;/track-statements&gt;
&lt;/statement&gt;
&lt;/datasource&gt;
&lt;/datasources&gt;  

    &lt;/beans&gt;
</code></pre>

<p>When I deploy the war file using the above JNDI configuration, I am getting the following error:</p>

<pre><code>Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AWDScriptController': Injection of autowired dependencies failed; 
nested exception is org.springframework.beans.factory.BeanCreationException:  
Could not autowire field: private com.dsths.cs.awd.services.ScriptTextFetcherService com.dsths.cs.awd.rest.ws.AWDScriptController.scriptService; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scriptTextFetcherService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dsths.cs.awd.dao.AWDFormDao com.dsths.cs.awd.services.ScriptTextFetcherService.awdDao;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AWDFormDao':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource com.dsths.cs.awd.dao.AWDFormDao.dataSource; nested exception is org.springframework.beans.
factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=awd)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'awd': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: CS/AWD_QA – service jboss.naming.context.java.CS.AWD_QA
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'awd': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: CS/AWD_QA – service jboss.naming.context.java.CS.AWD_QA
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'awd': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: CS/AWD_QA
</code></pre>

<p>Any ideas on what's going wrong here?</p>