In the hope of improving access performance in DB, I started to implement a pool of connections within my Web Application. But whenever I go to give a lookup in the application I get the following error
javax.naming.NameNotFoundException: Name [jdbc / bag] is not bound in this Context. Unable to find [jdbc]. at org.apache.naming.NamingContext.lookup (NamingContext.java:818) at org.apache.naming.NamingContext.lookup (NamingContext.java:166) at org.apache.naming.SelectorContext.lookup (SelectorContext.java:157) at javax.naming.InitialContext.lookup (InitialContext.java:417) at Filter.Filter filter (Filter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206 .... (continued)
Looking for multiple QeA and tutorials I ended up implementing the Tomcat
files as follows
server.xml
<GlobalNamingResources>
<Resource name="jdbc/bolsa" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="root" password="" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bolsa"/>
</GlobalNamingResources>
context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/zk_login">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<ResourceLink global="jdbc/bolsa" name="jdbc/bolsa" type="javax.sql.DataSource" />
<Resource name="jdbc/bolsa" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="root" password="" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bolsa"/>
</Context>
Inside my sistema
I