Can i run a stand alone java class(but which is included in my web application) to get a datasource for the tomcat connection pool? when i try to run the java cliass(its main method), i am getting the following exception:
I don't know what you mean by running a stand alone java class. Normally, classes in a web application are invoked by the application server. If you're trying to do something like this:
Then you're not really running "in" the webapp, just using the war as though it was a jar. And, since the JNDI registry is built and controlled by the Tomcat server, but you're not running in the server, there's no registry to be found.
An IDE is no substitute for an Intelligent Developer.
I've done this kind of thing to get to Weblogic EJB's from stand-alone applications. One has to specify an initial context factory, server URL and server credentials.
I don't know if Tomcat makes it's JNDI accessible like Weblogic does. Google pointed me to this guy who looks like he's got a number of the settings right, but still cannot look up a JNDI resource.
"Sakthivelmurugan Kg", please check your private messages for an important administrative matter.
Also, please use real words when posting to the forums. Abbreviations such as "reg" in place of "regarding" only serve to make your posts more difficult to read and less likely to generate useful responses.