1
我想在JBoss 6上部署.war文件,並且我已經使用JNDI創建了MySql數據源。JBoss 6數據源JNDI未找到
我的配置是這樣的:
在myDB-mysql-ds.xml
jndi-name : MyDataSource
in jboss-web.xml
res-ref-name : jdbc/MyDataSource
res-type : javax.sql.DataSource
jndi-name : java:/MyDataSource
在applicationContext.xml
property name="jndiName"
& its value : java:comp/env/jdbc/MyDataSource
當我部署此war文件,它被綁定到MyDatasource一樣,
INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MyDataSource' to JNDI name 'java:MyDataSource'
但我仍然得到錯誤:
ERROR [[/AppName]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [java:comp/env/jdbc/MyDataSource] not found: JNDI implementation returned null
該配置與jBoss 4.2.1配合良好,但在jBoss 6中出現錯誤。請幫我解決這個問題... –