I am having a JNDI named as jdbc/raDataSource.Now how to do the JNDI lookup??HOw will my application get the datasource which I have created?Also,what does the following mean: "java:comp/env/jdbc/raDataSource"??Where&in which class of my app will I write the code for the JNDI lookup?
Thanks Vijitha for the reply.What does this mean:java:comp/env?Anyways..moreover now how will I tell the webapp abt the datasource?Is it in the web.xml smthg like dis:
Also,in which part of my code will I write the code for JNDI lookup?
The java:comp/.... means the JNDI name for a particular resource, as for here, it is used for the data source. And your XML structure is correct for configuring a datasource to be used with JNDI, but that is 'not' to be used in web.xml descriptor. You need a separate descriptor like ejb-jar.xml (which will be deployed in the EJB container) to use this XML structure. However, with EJB 3.0, you don't need to use these XML configuration or even looking up for JNDI, because you can use annotations instead.
does comp/env also work with windows?? my app ran under jboss. and in glassfish i managed to get it deployed too. even my stateless session beans work. but i am not allowed to use DI for stateful session beans. so I would have to use lookup. But lookup works different in Glassfish than in JBoss Some "full" example would be great. I already added some ConnectionPool successfuly and some jdbc/mydb connection resource. The only thing that i think is missing is the correct JNDI lookup