0

I have a application running on Jboss server. on Jboss it uses JNDI sources for DB connection name cc.xml & iv.xml.(jboss/server/default/deploy/ Both jndi xml are here)

Now i have to deploy the same war on Tomcat and trying to create & access the JNDI sources from tomcat. I made following changes -

Added following code to META-INF/Context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/R2">
<ResourceLink name="ivrDataSource" global="ivrDataSource" type="javax.sql.DataSource"    />
<Resource
  name="ivrDataSource"
  type="javax.sql.DataSource"
  driverClassName="net.sourceforge.jtds.jdbc.Driver"
  password=""
  maxIdle="2"
  maxWait="5000"
  username="user"
  url="jdbc:jtds:sqlserver://abc:1433;DatabaseName=IVR_GUARDIAN;tds=8.0;lastupdatecount=false;socketKeepAlive=true;"
  maxActive="4"/>

  <ResourceLink name="ccDataSource" global="ccDataSource" type="javax.sql.DataSource" />
<Resource
name="ccDataSource"
type="javax.sql.DataSource"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
password=""
maxIdle="2"
maxWait="5000"
username="web"
    url="jdbc:jtds:sqlserver://xyz:1433;DatabaseName=CC_GUARDIAN;tds=8.0;lastupdatecount=false;socketKeepAlive=true;"
maxActive="4"/>
</Context>

ADDED BELOW TO WEB.XML ----

     <!-- FOR TOMCAT DEPLOYMRNT -TESTING  -->
   <resource-ref>
<description>ccDataSource</description>
<res-ref-name>ccDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
  </resource-ref>
  <resource-ref>
<description>ivrDataSource</description>
<res-ref-name>ivrDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>

But i am getting error-

  javax.naming.NameNotFoundException: Name ccDataSource,ivrDataSource is not bound in     this Context.

Always worked on JBOSS so this is new to me..Missing something here.Please suggest.

4

1 回答 1

0

您不必使用<ResourceLink>. 尝试删除<ResourceLink>s。

<ResourceLink>用于创建到全局 JNDI 资源的链接。

请参阅以下链接了解更多详情。

http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource%20Links

希望这可以帮助。

于 2013-08-01T05:34:00.150 回答