开发者

spring not able to find JNDI data source

开发者 https://www.devze.com 2023-03-14 06:30 出处:网络
I am developing a spring web开发者_如何学C application . A JAR file which I use in my application , is looking for DataSource using JNDI. I configured theelement in my tomcat\'s server.xml. The config

I am developing a spring web开发者_如何学C application . A JAR file which I use in my application , is looking for DataSource using JNDI. I configured the element in my tomcat's server.xml. The configuration is as below ,

<GlobalNamingResources>
  <Resource name="jdbc/abcd" 
            auth="Container" 
            type="javax.sql.DataSource" 
            maxActive="70"
            maxWait="10000" 
            username="xxxx" password="yyyy" 
            validationQuery="SELECT 1 from dual"
            driverClassName="oracle.jdbc.driver.OracleDriver" 
            url="jdbc:oracle:thin:@xx.xxx.xx.xx:xxxx:zzzz"
            testOnBorrow="false"
            testOnReturn="false"
            testWhileIdle="true"
            timeBetweenEvictionRunsMillis="120000"
            minEvictableIdleTimeMillis="3600000"
  />
</GlobalNamingResources>

The Resource name configured above , "jdbc/abcd" is the same which the JAR is looking for, But its not able to find this configured data source . Does anyone know what could be the reason ?

Am getting the below exception ,

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context


You need to define a ResourceLink in the web application context that makes the global resource visible to the web application.

<ResourceLink 
        name="nameThatIsVisibleToTheWebApplication"
        global="theGlobalName"
        ...


You need to do more than just configure Spring.

I'd recommend reading Tomcat JNDI documentation and this.

0

精彩评论

暂无评论...
验证码 换一张
取 消