RE: JNDI configuration with 6.0.29
I had something similar but referenced the Connection object right with it, essentially. Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/myoracle); // Allocate and use a connection from the pool Connection connection = ds.getConnection(); -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Thursday, September 08, 2011 4:11 PM To: Tomcat Users List Subject: Re: JNDI configuration with 6.0.29 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/8/2011 4:51 PM, Anjib Mulepati wrote: DataSource ds = null; try { 40. Context initCtx = new InitialContext(); 41.Context envCtx = (Context) initCtx.lookup(java:comp/env); 42. ds = (DataSource) envCtx.lookup(jdbc/dynic); Odd to use a local variable for this, but I guess you could do that. I've seen java:comp/env and java:/comp/env, but both seem to work. Try running this JSP. It's a bit fragile, but it should get the job done. - -chris ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; %@page pageEncoding=UTF-8 session=false language=Java import= javax.naming.InitialContext, javax.naming.Binding, javax.naming.Context, javax.naming.NamingEnumeration, javax.naming.NamingException % % String path = java:/comp/env; String pathParam = request.getParameter(path); if(null != pathParam !.equals(pathParam.trim())) path = pathParam.trim(); int pos = path.lastIndexOf('/'); String parent = pos 0 ? path.substring(0, pos) : java:comp/env; % html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleJNDI Browser: %= path %/title /head body h1JNDI Browser: %= path %/h1 pa href=?path=%= parent %%= parent %/a/p % InitialContext ctx = null; NamingEnumeration e = null; try { ctx = new InitialContext(); e = ctx.listBindings(path); if(e.hasMoreElements()) { % ul % while(e.hasMoreElements()) { Binding b = (Binding)e.next(); % li % if(b.getObject() instanceof Context) { % a href=?path=%= path %/%= b.getName() %%= b.getName() %/a % } else { % %= b.getName() % (%= b.getClassName() %) % } % /li % } % /ul % } else { % pJNDI context is empty/p % } } catch (NamingException ne) { % pError: %= ne.getMessage() %pre % java.io.PrintWriter myout = new java.io.PrintWriter(out); ne.printStackTrace(myout); myout.flush(); % /pre/p % } finally { if(null != e) try { e.close(); } catch (NamingException ne) { %p%= ne.getMessage() %/p% } if(null != ctx) try { ctx.close(); } catch (NamingException ne) { %p%= ne.getMessage() %/p% } }//foo % /body /html -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5pL3gACgkQ9CaO5/Lv0PBLAQCglRlAcKBZa5Gtrg494FfcvA2c /hIAoIu0fj/5ejz3+C3Pk/S8i1PeQG50 =F0ZW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/8/2011 5:51 PM, Anjib Mulepati wrote: when i click on java:/comp it gave error Error: Cannot create resource instance javax.naming.NamingException: Cannot create resource Then don't click on that. Click on something else under java:comp/env. If you have nothing under there (such as jdbc) then you really do not have your Resource configured properly. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5qhdUACgkQ9CaO5/Lv0PCwPgCfeWgYcBKZT8CIZqlBlrk2Tijo KI8An3pILatd2mNqb97XUgIVGHnml4P1 =wsa8 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
Tomcat log says SEVERE: Servlet.service() for servlet jsp threw exception javax.naming.NameNotFoundException: Name dynic is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.jsp.test_jsp._jspService(test_jsp.java:77) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) On 9/7/2011 5:40 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 12:57 PM, Anjib Mulepati wrote: I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Isn't that context path of web applciation is specified with the path attribute. http://tomcat.apache.org/tomcat-4.0-doc/config/context.html You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the documentation that is appropriate for your version of Tomcat: the path attribute is only appropriate when theContext is defined in server.xml, which is highly discouraged. The name of the XML file (when deployed) or the name of the WAR file (or exploded WAR directory structure) will dictate the context path and so it need not (and should not) be specified in context.xml. Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. To be safe can you tell me what change I have to do for that. Simply remove the factory attribute altogether. Tomcat knows what it's default is. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. I am wondering on same. Is there any way to debug this. Tomcat's logging usually provides some indication of a failure, but you haven't mentioned anything about log entries. Can you see if there are any log messages? Finally, try changing the user attribute to username. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB =9Gr4 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: JNDI configuration with 6.0.29 Reformatted
Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati: Yes I am positive So, your error message changes, if you change your factory code? Say, if you change your code like this ds = (DataSource) envCtx.lookup(jdbc/no_such_name); Do you see a message like NameNotFoundException: Name no_such_name is not bound...? Felix Anjib Man Mulepati 409-225-6216 Subject: Re: JNDI configuration with 6.0.29 Reformatted From: felix.schumac...@internetallee.de Date: Wed, 7 Sep 2011 17:17:21 +0200 To: users@tomcat.apache.org Anjib Mulepati anji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); } catch (NamingException e) { throw new DAOException(Tomcat JNDI setup failed, e); } this.dataSource = ds; } } On 9/6/2011 4:11 PM, Anjib Mulepati wrote: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793
Re: JNDI configuration with 6.0.29 Reformatted
yes after changing to ds = (DataSource) envCtx.lookup(jdbc/dummy_value); i am getting javax.naming.NameNotFoundException: Name dummy_value is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) On 9/8/2011 2:43 PM, Felix Schumacher wrote: Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati: Yes I am positive So, your error message changes, if you change your factory code? Say, if you change your code like this ds = (DataSource) envCtx.lookup(jdbc/no_such_name); Do you see a message like NameNotFoundException: Name no_such_name is not bound...? Felix Anjib Man Mulepati 409-225-6216 Subject: Re: JNDI configuration with 6.0.29Reformatted From: felix.schumac...@internetallee.de Date: Wed, 7 Sep 2011 17:17:21 +0200 To: users@tomcat.apache.org Anjib Mulepatianji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try { Context initCtx = new InitialContext();
Re: JNDI configuration with 6.0.29 Reformatted
Am Donnerstag, den 08.09.2011, 14:49 -0400 schrieb Anjib Mulepati: yes after changing to ds = (DataSource) envCtx.lookup(jdbc/dummy_value); i am getting javax.naming.NameNotFoundException: Name dummy_value is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) Ok, strange... Do you have any other error messages, you are not showing us? :) Where have you put your jdbc-driver for oracle? Bye Felix On 9/8/2011 2:43 PM, Felix Schumacher wrote: Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati: Yes I am positive So, your error message changes, if you change your factory code? Say, if you change your code like this ds = (DataSource) envCtx.lookup(jdbc/no_such_name); Do you see a message like NameNotFoundException: Name no_such_name is not bound...? Felix Anjib Man Mulepati 409-225-6216 Subject: Re: JNDI configuration with 6.0.29Reformatted From: felix.schumac...@internetallee.de Date: Wed, 7 Sep 2011 17:17:21 +0200 To: users@tomcat.apache.org Anjib Mulepatianji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try {
RE: JNDI configuration with 6.0.29 Reformatted
And do you have an instance of the jdbc driver in more than one place? -Original Message- From: Felix Schumacher [mailto:felix.schumac...@internetallee.de] Sent: Thursday, September 08, 2011 2:01 PM To: Tomcat Users List Subject: Re: JNDI configuration with 6.0.29 Reformatted Am Donnerstag, den 08.09.2011, 14:49 -0400 schrieb Anjib Mulepati: yes after changing to ds = (DataSource) envCtx.lookup(jdbc/dummy_value); i am getting javax.naming.NameNotFoundException: Name dummy_value is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) Ok, strange... Do you have any other error messages, you are not showing us? :) Where have you put your jdbc-driver for oracle? Bye Felix On 9/8/2011 2:43 PM, Felix Schumacher wrote: Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati: Yes I am positive So, your error message changes, if you change your factory code? Say, if you change your code like this ds = (DataSource) envCtx.lookup(jdbc/no_such_name); Do you see a message like NameNotFoundException: Name no_such_name is not bound...? Felix Anjib Man Mulepati 409-225-6216 Subject: Re: JNDI configuration with 6.0.29Reformatted From: felix.schumac...@internetallee.de Date: Wed, 7 Sep 2011 17:17:21 +0200 To: users@tomcat.apache.org Anjib Mulepatianji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager
Re: JNDI configuration with 6.0.29 Reformatted
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) Are you try to create a simple HttpServlet and run that code (lookup method) directly at doGetmethod ( i mean, no struts, no factory ) ? I'm not sure this be the problem but ... Regards - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
1. I have only one instance of jar file classes12.jar under lib folder of tomcat. 2. There is no other error I can see in the log. But error message do change to following Sep 8, 2011 3:50:45 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet action threw exception javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.anjib.factory.DynICFactory.init(DynICFactory.java:41) at com.anjib.actions.CommonAction.execute(CommonAction.java:42) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) On 9/7/2011 5:40 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 12:57 PM, Anjib Mulepati wrote: I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Isn't that context path of web applciation is specified with the path attribute. http://tomcat.apache.org/tomcat-4.0-doc/config/context.html You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the documentation that is appropriate for your version of Tomcat: the path attribute is only appropriate when theContext is defined in server.xml, which is highly discouraged. The name of the XML file (when deployed) or the name of the WAR file (or exploded WAR directory structure) will dictate the context path and so it need not (and should not) be specified in context.xml. Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. To be safe can you tell me what change I have to do for that. Simply remove the factory attribute altogether. Tomcat knows what it's default is. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. I am wondering on same. Is there any way to debug this. Tomcat's logging usually provides some indication of a failure, but you haven't mentioned anything about log entries. Can you see if there are any log messages? Finally, try changing the user attribute to username. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB =9Gr4 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 njib, On 9/8/2011 3:54 PM, Anjib Mulepati wrote: 1. I have only one instance of jar file classes12.jar under lib folder of tomcat. Wow... classes12? I remember that from back in the year 2000. Are you sure it isn't the old ZIP file they used to ship? 2. There is no other error I can see in the log. But error message do change to following Sep 8, 2011 3:50:45 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet action threw exception javax.naming.NameNotFoundException: Name jdbc is not bound in this Context So, the error message changed slightly (s/dynic/jdbc/). What configuration did you change? at com.anjib.factory.DynICFactory.init(DynICFactory.java:41) Just curious about this. Can you re-post your code for DynICFactory.init including the line numbers? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5pJo0ACgkQ9CaO5/Lv0PCrfQCdEz2iGOfym6Cqh3jQ67NZ/gCG Dt4AmwVdee4TQ4QN4Te3t6alzBneG78B =zoTV -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
1. Changed to ojdbc6 same problem. 2. I didn't change any config 3. public class DynICFactory implements JNDIInterface { private DataSource dataSource; @Override public DataSource getDataSource() { return dataSource; } @Override public AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try { 40. Context initCtx = new InitialContext(); 41.Context envCtx = (Context) initCtx.lookup(java:comp/env); 42. ds = (DataSource) envCtx.lookup(jdbc/dynic); 43. 44. } catch (NamingException e) { throw new DAOException(Tomcat JNDI setup failed, e); } this.dataSource = ds; } @Override public GroupInterface createGroupManager() { GroupImpl manager = new GroupImpl(); manager.setDataSource(dataSource); return manager; } } On 9/8/2011 4:33 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 njib, On 9/8/2011 3:54 PM, Anjib Mulepati wrote: 1. I have only one instance of jar file classes12.jar under lib folder of tomcat. Wow... classes12? I remember that from back in the year 2000. Are you sure it isn't the old ZIP file they used to ship? 2. There is no other error I can see in the log. But error message do change to following Sep 8, 2011 3:50:45 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet action threw exception javax.naming.NameNotFoundException: Name jdbc is not bound in this Context So, the error message changed slightly (s/dynic/jdbc/). What configuration did you change? at com.anjib.factory.DynICFactory.init(DynICFactory.java:41) Just curious about this. Can you re-post your code for DynICFactory.init including the line numbers? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5pJo0ACgkQ9CaO5/Lv0PCrfQCdEz2iGOfym6Cqh3jQ67NZ/gCG Dt4AmwVdee4TQ4QN4Te3t6alzBneG78B =zoTV -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/8/2011 4:51 PM, Anjib Mulepati wrote: DataSource ds = null; try { 40. Context initCtx = new InitialContext(); 41.Context envCtx = (Context) initCtx.lookup(java:comp/env); 42. ds = (DataSource) envCtx.lookup(jdbc/dynic); Odd to use a local variable for this, but I guess you could do that. I've seen java:comp/env and java:/comp/env, but both seem to work. Try running this JSP. It's a bit fragile, but it should get the job done. - -chris ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; %@page pageEncoding=UTF-8 session=false language=Java import= javax.naming.InitialContext, javax.naming.Binding, javax.naming.Context, javax.naming.NamingEnumeration, javax.naming.NamingException % % String path = java:/comp/env; String pathParam = request.getParameter(path); if(null != pathParam !.equals(pathParam.trim())) path = pathParam.trim(); int pos = path.lastIndexOf('/'); String parent = pos 0 ? path.substring(0, pos) : java:comp/env; % html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleJNDI Browser: %= path %/title /head body h1JNDI Browser: %= path %/h1 pa href=?path=%= parent %%= parent %/a/p % InitialContext ctx = null; NamingEnumeration e = null; try { ctx = new InitialContext(); e = ctx.listBindings(path); if(e.hasMoreElements()) { % ul % while(e.hasMoreElements()) { Binding b = (Binding)e.next(); % li % if(b.getObject() instanceof Context) { % a href=?path=%= path %/%= b.getName() %%= b.getName() %/a % } else { % %= b.getName() % (%= b.getClassName() %) % } % /li % } % /ul % } else { % pJNDI context is empty/p % } } catch (NamingException ne) { % pError: %= ne.getMessage() %pre % java.io.PrintWriter myout = new java.io.PrintWriter(out); ne.printStackTrace(myout); myout.flush(); % /pre/p % } finally { if(null != e) try { e.close(); } catch (NamingException ne) { %p%= ne.getMessage() %/p% } if(null != ctx) try { ctx.close(); } catch (NamingException ne) { %p%= ne.getMessage() %/p% } }//foo % /body /html -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5pL3gACgkQ9CaO5/Lv0PBLAQCglRlAcKBZa5Gtrg494FfcvA2c /hIAoIu0fj/5ejz3+C3Pk/S8i1PeQG50 =F0ZW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
when i click on java:/comp http://localhost:8080/ClientDAOTest/newjsp.jsp?path=java:/comp it gave error Error: Cannot create resource instance javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71) at org.apache.jsp.newjsp_jsp._jspService(newjsp_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) When I click onjdbc http://localhost:8080/ClientDAOTest/newjsp.jsp?path=java:comp/env/jdbc it give error Error: Name jdbc is not bound in this Context javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71) at org.apache.jsp.newjsp_jsp._jspService(newjsp_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) On 9/8/2011 5:11 PM, Christopher
Re: JNDI configuration with 6.0.29
On 06/09/2011 21:11, Anjib Mulepati wrote: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations:1. In META-INF/context.xmlContext antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynicauth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDITuser=sfed_schema password=sfed_schemamaxActive=20 maxIdle=10maxWait=-1 / /Context2. In WEB-INF/web.xmlresource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 2. In factory class I havepublic class DynICFactory implements JNDIInterface{ private DataSource dataSource;@Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource);return manager;} public DynICFactory() throws DAOException {DataSource ds = null; try {Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env);ds = (DataSource) envCtx.lookup(jdbc/dynic);} catch (NamingException e) {throw new DAOException(Tomcat JNDI setup failed, e);}this.dataSource = ds;}} That came out garbled. Can you reformat it so we can read it? p signature.asc Description: OpenPGP digital signature
RE: JNDI configuration with 6.0.29
I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xmlContext antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xmlresource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I havepublic class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Override public DataSource getDataSource() { return dataSource; } @Override public AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException {DataSource ds = null; try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); ds = (DataSource) envCtx.lookup(jdbc/dynic);} catch (NamingException e) { throw new DAOException(Tomcat JNDI setup failed, e); } this.dataSource = ds; } Anjib Man Mulepati 409-225-6216 Date: Wed, 7 Sep 2011 10:55:19 +0100 From: p...@pidster.com To: users@tomcat.apache.org Subject: Re: JNDI configuration with 6.0.29 On 06/09/2011 21:11, Anjib Mulepati wrote: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations:1. In META-INF/context.xmlContext antiJARLocking=true path=/ClientDAOTestResource name=jdbc/dynic auth=Containertype=oracle.jdbc.pool.OracleDataSource
Re: JNDI configuration with 6.0.29 Reformatted
Anjib Mulepati anji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); ds = (DataSource) envCtx.lookup(jdbc/dynic); } catch (NamingException e) { throw new DAOException(Tomcat JNDI setup failed, e); } this.dataSource = ds; } } On 9/6/2011 4:11 PM, Anjib Mulepati wrote: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
RE: JNDI configuration with 6.0.29 Reformatted
Yes I am positive Anjib Man Mulepati 409-225-6216 Subject: Re: JNDI configuration with 6.0.29 Reformatted From: felix.schumac...@internetallee.de Date: Wed, 7 Sep 2011 17:17:21 +0200 To: users@tomcat.apache.org Anjib Mulepati anji...@hotmail.com schrieb: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us? Bye Felix Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41) com.anjib.actions.CommonAction.execute(CommonAction.java:42) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) I ran same program with Tomcat 7.0.12 and it works fine. Here are my configurations: 1. In META-INF/context.xml Context antiJARLocking=true path=/ClientDAOTest Resource name=jdbc/dynic auth=Container type=oracle.jdbc.pool.OracleDataSource driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / /Context 2. In WEB-INF/web.xml resource-ref res-ref-namejdbc/dynic/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref 3. In factory class I have public class DynICFactory implements JNDIInterface{ private DataSource dataSource; @Overridepublic DataSource getDataSource() {return dataSource;} @Overridepublic AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl(); manager.setDataSource(dataSource); return manager; } public DynICFactory() throws DAOException { DataSource ds = null; try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); ds = (DataSource) envCtx.lookup(jdbc/dynic); } catch (NamingException e) { throw new DAOException(Tomcat JNDI setup failed, e); } this.dataSource = ds; } } On 9/6/2011 4:11 PM, Anjib Mulepati wrote: Hi All, I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29. This is giving me following error javax.naming.NameNotFoundException: Name dynic is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:770) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97) javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) org.apache.naming.NamingContext.lookup(NamingContext.java:793) org.apache.naming.NamingContext.lookup(NamingContext.java:140) org.apache.naming.NamingContext.lookup(NamingContext.java:781) org.apache.naming.NamingContext.lookup(NamingContext.java:153) com.anjib.factory.DynICFactory.init(DynICFactory.java:41
Re: JNDI configuration with 6.0.29 Reformatted
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 11:22 AM, Anjib Mulepati wrote: Yes I am positive If you have changed your META-INF/context.xml without doing an undeploy/redeploy, Tomcat may be using an older version of the deployment descriptor than you think it is. Take a look at CATALINA_BASE/conf/Catalina/[hostname]/[appname].xml and see if it contains what you expect it to contain (i.e. jdbc/dynic). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5nmKEACgkQ9CaO5/Lv0PBgigCghqHFuyP7EdhO52nHXqX61CjV 5G8An2j+WGBaf6smXcS7MiCYrOq0iTIH =pVtB -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic password=sfed_schema type=oracle.jdbc.pool.OracleDataSource url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema/ /Context Same config work for Tomcat 7 so I am wondering is there any thing I have to different/extra in Tomcat 6 Thanks, Anjib On 9/7/2011 12:15 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 11:22 AM, Anjib Mulepati wrote: Yes I am positive If you have changed your META-INF/context.xml without doing an undeploy/redeploy, Tomcat may be using an older version of the deployment descriptor than you think it is. Take a look at CATALINA_BASE/conf/Catalina/[hostname]/[appname].xml and see if it contains what you expect it to contain (i.e. jdbc/dynic). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5nmKEACgkQ9CaO5/Lv0PBgigCghqHFuyP7EdhO52nHXqX61CjV 5G8An2j+WGBaf6smXcS7MiCYrOq0iTIH =pVtB -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 12:21 PM, Anjib Mulepati wrote: I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. password=sfed_schema type=oracle.jdbc.pool.OracleDataSource url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema/ I have username as the attribute in my Resource, but this might be the way you have to configure Oracle's factory. Here's what I've got in my configuration: Resource name=jdbc/db description=db auth=Container type=javax.sql.DataSource maxActive=1 maxIdle=1 maxWait=1 url=jdbc:[url] username=scott password=tiger driverClassName=com.mysql.jdbc.Driver removeAbandoned=true removeAbandonedTimeout=30 logAbandoned=true testOnBorrow=true validationQuery=/* ping */ SELECT 1 / (That validationQuery is a short-cut for MySQL connection testing. Feel free to use something like SELECT 1 FROM DUAL when using Oracle). Same config work for Tomcat 7 so I am wondering is there any thing I have to different/extra in Tomcat 6 The configuration should be identical to Tomcat 6. Do you see any messages in your logs during webapp startup? I wrote a JSP-based JNDI navigator a while back but I can't seem to find it. Maybe I'll whip one up so you can look-around the JNDI tree to see if your DataSource is just misplaced. I'm sure you can write one yourself fairly easily, too. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN =sBGp -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Isn't that context path of web applciation is specified with the path attribute. http://tomcat.apache.org/tomcat-4.0-doc/config/context.html Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. To be safe can you tell me what change I have to do for that. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. I am wondering on same. Is there any way to debug this. password=sfed_schema type=oracle.jdbc.pool.OracleDataSource url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema/ I have username as the attribute in myResource, but this might be the way you have to configure Oracle's factory. Here's what I've got in my configuration: Resource name=jdbc/db description=db auth=Container type=javax.sql.DataSource maxActive=1 maxIdle=1 maxWait=1 url=jdbc:[url] username=scott password=tiger driverClassName=com.mysql.jdbc.Driver removeAbandoned=true removeAbandonedTimeout=30 logAbandoned=true testOnBorrow=true validationQuery=/* ping */ SELECT 1 / (That validationQuery is a short-cut for MySQL connection testing. Feel free to use something like SELECT 1 FROM DUAL when using Oracle). Same config work for Tomcat 7 so I am wondering is there any thing I have to different/extra in Tomcat 6 The configuration should be identical to Tomcat 6. Do you see any messages in your logs during webapp startup? I wrote a JSP-based JNDI navigator a while back but I can't seem to find it. Maybe I'll whip one up so you can look-around the JNDI tree to see if your DataSource is just misplaced. I'm sure you can write one yourself fairly easily, too. Yes that will be helpful. Any clue will be appreciated. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN =sBGp -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
i change to Resource name=jdbc/dynic auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema password=sfed_schema maxActive=20 maxIdle=10 maxWait=-1 / and still same problem. On 9/7/2011 12:31 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 12:21 PM, Anjib Mulepati wrote: I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. password=sfed_schema type=oracle.jdbc.pool.OracleDataSource url=jdbc:oracle:thin:@//localhost:4001/SAIDIT user=sfed_schema/ I have username as the attribute in myResource, but this might be the way you have to configure Oracle's factory. Here's what I've got in my configuration: Resource name=jdbc/db description=db auth=Container type=javax.sql.DataSource maxActive=1 maxIdle=1 maxWait=1 url=jdbc:[url] username=scott password=tiger driverClassName=com.mysql.jdbc.Driver removeAbandoned=true removeAbandonedTimeout=30 logAbandoned=true testOnBorrow=true validationQuery=/* ping */ SELECT 1 / (That validationQuery is a short-cut for MySQL connection testing. Feel free to use something like SELECT 1 FROM DUAL when using Oracle). Same config work for Tomcat 7 so I am wondering is there any thing I have to different/extra in Tomcat 6 The configuration should be identical to Tomcat 6. Do you see any messages in your logs during webapp startup? I wrote a JSP-based JNDI navigator a while back but I can't seem to find it. Maybe I'll whip one up so you can look-around the JNDI tree to see if your DataSource is just misplaced. I'm sure you can write one yourself fairly easily, too. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN =sBGp -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JNDI configuration with 6.0.29
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anjib, On 9/7/2011 12:57 PM, Anjib Mulepati wrote: I did checked the XML file and it looks correct to me. Following is the content: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true docBase=C:\Users\amulepati\My Projects\ClientDAOTest\build\web path=/ClientDAOTest It probably has no bearing on this particular problem, but the path attribute is illegal here. Isn't that context path of web applciation is specified with the path attribute. http://tomcat.apache.org/tomcat-4.0-doc/config/context.html You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the documentation that is appropriate for your version of Tomcat: the path attribute is only appropriate when the Context is defined in server.xml, which is highly discouraged. The name of the XML file (when deployed) or the name of the WAR file (or exploded WAR directory structure) will dictate the context path and so it need not (and should not) be specified in context.xml. Resource auth=Container driverClassName=oracle.jdbc.driver.OracleDriver factory=oracle.jdbc.pool.OracleDataSourceFactory Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to use it's own DataSourceFactory. To be safe can you tell me what change I have to do for that. Simply remove the factory attribute altogether. Tomcat knows what it's default is. maxActive=20 maxIdle=10 maxWait=-1 name=jdbc/dynic I'm curious why the lookup fails with the message about dynic and not, as Felix asks, jdbc/dynic. I am wondering on same. Is there any way to debug this. Tomcat's logging usually provides some indication of a failure, but you haven't mentioned anything about log entries. Can you see if there are any log messages? Finally, try changing the user attribute to username. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB =9Gr4 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org