On 04/03/2012 23:37, Adib wrote: > Hi, > > I think I have run into a bug with tomcat, but wanted to check with > the user list to make sure it is a bug before I file it. Good job you checked. It isn't a bug, it is user error.
> Background: > > I am using the tomact jdbc pool over the dbcp pool and I am embedding > tomcat as part of an application that clients install on their data > centers. > > 1) delete the lib\tomcat-dbcp.jar from the tomcat\lib Unnecessary. > 2) Configure a jdbc connection pool in server.xml in the GlobalNamingResource Looks OK. > 3) Add a resource ref to the web.xml And here is where you go wrong. You need to read [1]. You can use a <resource-ref> if all of the following are true: a) Tomcat is able to identify a suitable factory b) No further configuration is required. a) is true but not what you want. Tomcat will use the default. b) is not true. More information is required (URL, user, pwd, etc) Since a resource-ref is not suitable, you must define a resource-link to a global resource or the entire resource in the context.xml. The resource ref in web.xml is more a marker that a resource is required. It isn't usually sufficient to define the resource. > 4) do an a lookup for the data source Looks OK. > 5) Tomcat throws an exception java.lang.ClassNotFoundException: > org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory full stack trace > below. As expected, given the error you have made. > It is not clear why it would be looking for dbcp DataSource when i > have my data source defined using > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" Because you haven't configured you DataSource correctly. > Interestingly if the resource is defined in context.xml in META-INF > for the war there are no exceptions it just works. As expected. > Any thoughts on whether this is a bug or not? As above. No bug, this is user error. Mark [1] http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org