2016-10-04 6 views
0

Jboss eap 6.1.0サーバにwarファイルをデプロイしました。私は私のプロジェクトでSpringフレームワークを使用しています。 sample-ds.xml(JBOSS配備フォルダの下に保管)とdataSourceConfiguration.xml(これはwarファイルの一部であり、applicationContext.xmlファイルによって読み込まれます)という2つのファイルを使用してJNDIを構成しました。 dataSourceConfiguration.xmlは以下の通りです:JBossのeap 6.1.0におけるSpringフレームワークのJNDI設定の問題

<beans> 

<jee:jndi-lookup id="awd"    jndi-name="CS/AWD_QA"   resource-ref="false" /> 


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

マイサンプル-ds.xmlのは以下の通りです:

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

    </beans> 

私は上記のJNDIの設定を使用してWARファイルをデプロイする場合、私は次のエラーを取得しています:

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 

ここで何が問題になっているかについてのアイデアはありますか?

答えて

0

java:jboss/をデータソース名に追加してください。

<jee:jndi-lookup id="awd"    jndi-name="java:jboss/CS/AWD_QA"   resource-ref="false" /> 

これが機能しない場合、あなたは

Javaへのデータソースの名前を変更することができます:/ JDBC/CS/AWD_QA

<jee:jndi-lookup id="awd"    jndi-name="java:/jdbc/CS/AWD_QA"   resource-ref="false" /> 
関連する問題