I am using Tomcat 5.5.27. I have two web applications- App1 and App2. Below are some details-
App1 Data Source JNDI name - jdbc/DW_Pool
App1 web context name - tdwebapps
App2 Data Source JNDI name - jdbc/SQLPool_DW
App2 web context name - tdreports
My context.xml and server.xml are given at the end of this post.
When I start Tomcat with these configurations and try to access my application, I see the following error in the log-
Aug 25, 2009 10:14:12 PM org.eclipse.birt.report.data.oda.jdbc.JndiDataSource getConnection
INFO: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Aug 25, 2009 10:14:12 PM org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection
SEVERE: Cannot open connection.
My questions are-
1) Where am I going wrong? How to get rid of this exception?
2) I referred to the Tomcat config documentation given at- http://tomcat.apache.org/tomcat-5.5-doc/config/index.html However, I have not been able to understand the significance of Context.xml file exactly. If we can configure contrexts, resources etc. in server.xml file, what purpose does the Context.xml file serve?
Context.xml allows you to define the context for a single webapp in a discrete file. Effectively, all the context files are merged into server.xml. But by physically separating them, you can redeploy a single webapp without changing server.xml itself, which would require restarting the entire server.
As a fat-fingered user type, there's another benefit. If you damage server.xml, the entire Tomcat server may become unusable. So by editing only a single context file, you only put that particular webapp at risk.
Use of a separate context file became the preferred way to define a webapp context starting in Tomcat 4 and continuing to the present day. You can also include a copy of the context as META-INF/context.xml (I may have that mis-capitalized) in your WAR, which allows you to make "drag and drop" WARs complete with JNDI and other container definitions that normally would be external to the war.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Neelesh A Korade
posted 9 years ago
Thank you Tim. That was helpful.
Could someone help me out with the data source lookup exception I am seeing?