This discussion is archived
0 Replies Latest reply: Aug 23, 2008 12:33 AM by 843793 RSS

how to use tomcat JNDI  resource in eclipse

843793 Newbie
Currently Being Moderated

hi all, In my project i am using JSF,Tomcat,eclipse... i am planing to implement annotaions as part of my application
I want to use Jndi resource as part of my project by using java annotaions

for this i configured my server.xml in tomcat as
<Context docBase="ALWREPORTSNEW" path="/ALWREPORTSNEW"
reloadable="true"
source="org.eclipse.jst.jee.server:ALWREPORTSNEW" >

<Resource auth="Container"
driverClassName="com.mysql.jdbc.Driver" maxActive="10000"
maxIdle="3000" maxWait="10000" name="jdbc/enrollmentschema"
password="adminadmin" removeAbandoned="true"
removeAbandonedTimeout="300" type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/enrollment_schema_old"
username="root" />


</Context>
And i configured web.xml as
<resource-ref>
<description>Enrollment Schema Connection pooling</description>
<res-ref-name>jdbc/enrollmentschema</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
And some where in my project i am using annotaion as follows. i am getting NULL when trying access that annotaion .





@Resource(name = "jdbc/mobileEnrollProd") DataSource mobileds;
@Resource(name = "jdbc/enrollmentschema")
private DataSource enrollds;


public String UploadBankWise() {

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
System.out.println("--------- ds "+enrollds);// *i am getting NULL*


}
but same code working with Glassfish and net benas..



can any body hint me where i did mistake



thanks in advance