Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到JBoss 6数据源JNDI_Jboss_Datasource_Jndi - Fatal编程技术网

找不到JBoss 6数据源JNDI

找不到JBoss 6数据源JNDI,jboss,datasource,jndi,Jboss,Datasource,Jndi,我正试图在JBoss6上部署.war文件,我已经创建了MySql数据源,我想使用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 property name="jndiName" & it

我正试图在JBoss6上部署.war文件,我已经创建了MySql数据源,我想使用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
property name="jndiName"
& its value : java:comp/env/jdbc/MyDataSource
applicationContext.xml中

jndi-name : MyDataSource
in jboss-web.xml
res-ref-name : jdbc/MyDataSource
res-type : javax.sql.DataSource
jndi-name : java:/MyDataSource
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

这是因为你以错误的方式访问它。你应该做以下几件事

false


然后通过它的
JNDI名称访问它

这是因为您访问它的方式不对。你应该做以下几件事

false


然后通过它的
JNDI名称访问它

这个配置在JBoss4.2.1中运行良好,但是我在JBoss6中遇到了错误。。请帮我解决这个问题…这个配置在jBoss 4.2.1中运行得很好,但是我在jBoss 6中遇到了错误。。请帮我解决这个问题。。。