RE: JNDI and DataSource
Yeap, Daniel. It's there. As I mentioned, I performed the very same test I'm doing right now, but without DataSource and it works. Now that you mention it, I read in some place that it was necessary to remove the java.sql.* package from the jdbc jar file. I don't know if that is true and, if so, why would that be necessary? Could that have something to do with this problem? (it would be something very odd since it would be affecting exclusively the behaviour of the DataSource, according to what I stated on the previous paragraph. Regards, Freddy. -Mensaje original- De: Daniel Huang [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 20:57 Para: Tomcat Users List Asunto: RE: JNDI and DataSource Where did you put your db driver jar file? You want to put it under $CATILINA/common/lib. Regards, Daniel -Original Message- From: Freddy Villalba Arias [mailto:[EMAIL PROTECTED] Sent: Monday, April 12, 2004 10:19 AM To: Tomcat Users List Subject: RE: JNDI and DataSource Tested it. Same result... same problem. A side comment: the positive part of the other config file (the one I had originally) was that you could trace how Tomcat loaded the Resources. Then, you could see how the tags actually got processed (read) correctly. But then, something happens when the factory builds the DataSource object. Regards, Freddy. -Mensaje original- De: Guy Pardon [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 19:02 Para: Tomcat Users List Asunto: Re: JNDI and DataSource Hi, The fact that you get 'No suitable driver' could also mean that the chosen properties are incompatible (as opposed to not set). Just a guess: did you try to specify the user and password as part of the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED]) That's the way I usually connect to oracle. You never know, maybe that's it... HTH, Guy http://www.atomikos.com - Our JTA for your transactions On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba Arias wrote: image.tiff Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists... Any other suggestion? (I'll keep looking at it, too... obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context
JNDI and DataSource
Hi everybody, This is a fairly simple problem, however this is one of those days a huge truck could easily pass over you without you even noticing it... anyway, here it goes! The environment is: JBuilder X + Tomcat 4.1 + DBCP The problem: I want to obtain a DB connection through a DataSource that I'm looking up using JNDI, configuring it inside server.xml So far, I'm obtaining a reference to the DataSource object as expected, using the jdbc/cnid name (that's the one I gave to that resource) on the java:comp/env Context. However, that object is not initialized and - the most bizarre part - the properties that I specified for that resource inside serverXXX.xml are not populated. I've read many postings and tutorials, even cut / pasted (adapted) several similar examples I've found throughout the web, but can't seem to make them work. I've already tested DB connections without DataSources and they work just fine. This is the server.xml file: ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true Context path=wa docBase=..\..\Testing debug=5 reloadable=true Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server This is the exception thrown when attempting to obtain a Connection from the DataSource I just looked-up (note that I'm printing the DataSource object on the second line of the log below): StandardHost[localhost]: Mapped to context '/wa' [EMAIL PROTECTED] org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:244) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:743) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:518) at com.bilbomatica.cnid.services.DBServiceProvider.getConnection(DBServiceP rovider.java:71) at org.apache.jsp.test_jsp._jspService(test_jsp.java:103) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at
RE: JNDI and DataSource
I MEANT OVER ME!!! Sorry... as you can see, I'm a little burned-out here... Thankx. -Mensaje original- De: Freddy Villalba Arias Enviado el: lunes, 12 de abril de 2004 15:44 Para: [EMAIL PROTECTED] Asunto: JNDI and DataSource Hi everybody, This is a fairly simple problem, however this is one of those days a huge truck could easily pass over you without you even noticing it... anyway, here it goes! The environment is: JBuilder X + Tomcat 4.1 + DBCP The problem: I want to obtain a DB connection through a DataSource that I'm looking up using JNDI, configuring it inside server.xml So far, I'm obtaining a reference to the DataSource object as expected, using the jdbc/cnid name (that's the one I gave to that resource) on the java:comp/env Context. However, that object is not initialized and - the most bizarre part - the properties that I specified for that resource inside serverXXX.xml are not populated. I've read many postings and tutorials, even cut / pasted (adapted) several similar examples I've found throughout the web, but can't seem to make them work. I've already tested DB connections without DataSources and they work just fine. This is the server.xml file: ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true Context path=wa docBase=..\..\Testing debug=5 reloadable=true Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server This is the exception thrown when attempting to obtain a Connection from the DataSource I just looked-up (note that I'm printing the DataSource object on the second line of the log below): StandardHost[localhost]: Mapped to context '/wa' [EMAIL PROTECTED] org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:244) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:743) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:518) at com.bilbomatica.cnid.services.DBServiceProvider.getConnection(DBServiceP rovider.java:71) at org.apache.jsp.test_jsp._jspService(test_jsp.java:103) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193
Re: JNDI and DataSource
You have a default context right after the wa context that doesn't specify a Resource . Is that what you meant? Sandy On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote: [...] /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI and DataSource
Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd remove it if I knew how to elegantly solve the dummy web app - or just no default web app, if possible - issue), but it does the job for now (if you can provide some insight on this other subject, I would also appreciate it). HTH. -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 17:32 Para: Tomcat Users List Asunto: Re: JNDI and DataSource You have a default context right after the wa context that doesn't specify a Resource . Is that what you meant? Sandy On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote: [...] /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI and DataSource
This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd remove it if I knew how to elegantly solve the dummy web app - or just no default web app, if possible - issue), but it does the job for now (if you can provide some insight on this other subject, I would also appreciate it). HTH. -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 17:32 Para: Tomcat Users List Asunto: Re: JNDI and DataSource You have a default context right after the wa context that doesn't specify a Resource . Is that what you meant? Sandy On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote: [...] /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI and DataSource
Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists Any other suggestion? (Ill keep looking at it, too obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd remove it if I knew how to elegantly solve the dummy web app - or just no default web app, if possible - issue), but it does the job for now (if you can provide some insight on this other subject, I would also appreciate it). HTH. -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 17:32 Para: Tomcat Users List Asunto: Re: JNDI and DataSource You have a default context right after the wa context that doesn't specify a Resource . Is that what you meant? Sandy On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote: [...] /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI and DataSource
Hi, The fact that you get 'No suitable driver' could also mean that the chosen properties are incompatible (as opposed to not set). Just a guess: did you try to specify the user and password as part of the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED]) That's the way I usually connect to oracle. You never know, maybe that's it... HTH, Guy http://www.atomikos.com - Our JTA for your transactions On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba Arias wrote: image.tiff Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists Any other suggestion? (Ill keep looking at it, too obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd remove it if I knew how to elegantly solve the dummy web app - or just no default web app, if possible - issue), but it does the job for now (if you can provide some insight on this other subject, I would also appreciate it). HTH. -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 17:32 Para: Tomcat Users List Asunto: Re: JNDI and DataSource You have a default context right after the wa context that doesn't specify a Resource . Is that what you meant? Sandy On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote: [...] /ResourceParams /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Dr. Guy Pardon ( [EMAIL PROTECTED] ) Atomikos: Your Partner for Reliable eBusiness Coordination http://www.atomikos.com/ The information in this email is confidential and only meant for the addressee(s). The content of this email is informal and will not be legally binding for Atomikos.
RE: JNDI and DataSource
Hi Guy, That's interesting. I hadn't thought about that possibility. I'll try it. However, let me state that I don't think that's the problem (hope I'm wrong, of course!) since the inspection (JBuilder inspector) on the java variable holding the reference to the DataSource object reveals that the properties are indeed not being populated (in fact, there is an attribute dataSource which I suppose is intended for holding the actual DataSource and it's null as well). Anyway, can't discard anything and your help is appreciated. Will let you know the outcome of this test. Cheers, Freddy. -Mensaje original- De: Guy Pardon [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 19:02 Para: Tomcat Users List Asunto: Re: JNDI and DataSource Hi, The fact that you get 'No suitable driver' could also mean that the chosen properties are incompatible (as opposed to not set). Just a guess: did you try to specify the user and password as part of the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED]) That's the way I usually connect to oracle. You never know, maybe that's it... HTH, Guy http://www.atomikos.com - Our JTA for your transactions On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba Arias wrote: image.tiff Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists... Any other suggestion? (I'll keep looking at it, too... obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved
RE: JNDI and DataSource
Tested it. Same result... same problem. A side comment: the positive part of the other config file (the one I had originally) was that you could trace how Tomcat loaded the Resources. Then, you could see how the tags actually got processed (read) correctly. But then, something happens when the factory builds the DataSource object. Regards, Freddy. -Mensaje original- De: Guy Pardon [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 19:02 Para: Tomcat Users List Asunto: Re: JNDI and DataSource Hi, The fact that you get 'No suitable driver' could also mean that the chosen properties are incompatible (as opposed to not set). Just a guess: did you try to specify the user and password as part of the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED]) That's the way I usually connect to oracle. You never know, maybe that's it... HTH, Guy http://www.atomikos.com - Our JTA for your transactions On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba Arias wrote: image.tiff Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists... Any other suggestion? (I'll keep looking at it, too... obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd remove it if I knew how to elegantly solve the dummy web app - or just no default web app, if possible - issue), but it does the job for now (if you can
RE: JNDI and DataSource
Where did you put your db driver jar file? You want to put it under $CATILINA/common/lib. Regards, Daniel -Original Message- From: Freddy Villalba Arias [mailto:[EMAIL PROTECTED] Sent: Monday, April 12, 2004 10:19 AM To: Tomcat Users List Subject: RE: JNDI and DataSource Tested it. Same result... same problem. A side comment: the positive part of the other config file (the one I had originally) was that you could trace how Tomcat loaded the Resources. Then, you could see how the tags actually got processed (read) correctly. But then, something happens when the factory builds the DataSource object. Regards, Freddy. -Mensaje original- De: Guy Pardon [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12 de abril de 2004 19:02 Para: Tomcat Users List Asunto: Re: JNDI and DataSource Hi, The fact that you get 'No suitable driver' could also mean that the chosen properties are incompatible (as opposed to not set). Just a guess: did you try to specify the user and password as part of the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED]) That's the way I usually connect to oracle. You never know, maybe that's it... HTH, Guy http://www.atomikos.com - Our JTA for your transactions On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba Arias wrote: image.tiff Hi Sandy, Thanks, it certainly looked better than mine. I appreciate it. However, the problem persists... Any other suggestion? (I'll keep looking at it, too... obviously) -Mensaje original- De: Sandy McArthur [mailto:[EMAIL PROTECTED] Enviado el: lunes, 12de abril de 2004 18:29 Para: Tomcat Users List Asunto: Re: JNDI and DataSource This shouldn't be all that different, but this is the server.xml I'd use on my setup. ?xml version=1.0 encoding=UTF-8? Server debug=5 port=8081 shutdown=SHUTDOWN GlobalNamingResources Resource name=jdbc/cnid scope=Shareable type=javax.sql.DataSource cached=false/ ResourceParams name=jdbc/cnid parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value /parameter parameter nameusername/name valueSGC_CNID/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector acceptCount=10 className=org.apache.coyote.tomcat4.CoyoteConnector connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5 port=8080/ Engine debug=5 defaultHost=localhost name=Standalone Host appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true DefaultContext ResourceLink name=jdbc/cnid global=jdbc/cnid type=javax.sql.DataSource/ /DefaultContext Context path=wa docBase=..\..\Testing debug=5 reloadable=true /Context Context path= docBase=..\..\Testing debug=5 reloadable=true /Context /Host /Engine /Service /Server HTH Sandy On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote: Yes and no... :) I have only one web application to be deployed (wa). Then, I read in some places that it's mandatory to have a default context. I tried defining a DefaultContext but then Tomcat's initialization failed (I looked for something odd but couldn't find anything). So, I decided to create a default (dummy) web app by hand. That's the only intent of that second web app. It doesn't even exist (there is no WEB-INF directory, leave alone web.xml). The good part: that solved the initialization problem. So, it's not what I originally wanted (I'd
JNDI based Datasource - anybody got a working example?
Hi all, I am trying to configure tomcat to provide a JNDI Datasource, both so that the container can provide Basic Authentication, and for the war file to use (via Torque). I have followed the instructions at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html, which claim to be untested - these instructions do not work. Any attempt at auth results in the following exception: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:467) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:315) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:161) Has anybody successfully managed to get tomcat to do this? If so, can you post an example to use? Regards, Graham -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI based Datasource - anybody got a working example?
Graham, I am trying to configure tomcat to provide a JNDI Datasource, both so that the container can provide Basic Authentication, and for the war file to use (via Torque). I have done this (including Torque!). It took a bit of playing around, but I found that I had to do the following. (Others please take note: I'd like to know if I could have gotton away with fewer steps... please let me know if that's the case) 1. Define a Resource in the GlobalNamingResources section of server.xml: Resource name=@DATASOURCE_REF@ auth=Container type=javax.sql.DataSource/ ResourceParams name=@DATASOURCE_REF@ ... /ResourceParams (I'm using ant to replace the DATSOURCE_REF marker with jdbc/myDataSource). I have deduced that Tomcat requires this to be defined at the global level because of where the authenticator runs -- which appears to be *outside* the context for which you want to authenticate users. 2. Put your Realm inside the Context for which you want to authenticate: Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=@DATASOURCE_REF@ userTable=user userRoleTable=user_role userNameCol=username userCredCol=password roleNameCol=rolename digest=MD5 debug=99 / Somewhat obviously, this sets up the Realm and allows the authentication to take place. 3. Add a ResourceLink to the Context section for my particular context: ResourceLink name=@DATASOURCE_REF@ global=@DATASOURCE_REF@ type=javax.sql.DataSource / This links a global resource to the context, and makes it available for use by the webapp. 4. Add a resource-ref section to my web.xml: resource-ref descriptionDataSource for my application/description res-ref-namejdbc/myDataSource/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I think this actually creates the other side of the link that it established with the ResourceLink in the server.xml. I'm not entirely sure. javax.naming.NameNotFoundException: Name jdbc is not bound in this Context I was getting this same error and played around for the better part of two days to get this working. Finally, I can do all of these things: 1. Use the Realm the way I want to 2. Have Torque use the same JNDI DataSource (Just so you know, this is what I use for my torque JNDI setup: [EMAIL PROTECTED]@.jndi.path=java:comp/env/@DATASOURCE_REF@ ) 3. Browse the JNDI tree by hand (from a JSP within my context) and actually see the DataSource object in there. Woo hoo! I hope that helps. -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI based Datasource - anybody got a working example?
Christopher Schultz wrote: I was getting this same error and played around for the better part of two days to get this working. Finally, I can do all of these things: 1. Use the Realm the way I want to 2. Have Torque use the same JNDI DataSource (Just so you know, this is what I use for my torque JNDI setup: [EMAIL PROTECTED]@.jndi.path=java:comp/env/@DATASOURCE_REF@ ) 3. Browse the JNDI tree by hand (from a JSP within my context) and actually see the DataSource object in there. Woo hoo! I hope that helps. You are an absolute legend! One key thing that you mentioned, that is not in any of the docs, is that torque needs the JNDI path set absolute. ie java:comp/ev/jdbc/myDatabase works, but jdbc/myDatabase on its own does not. Regards, Graham -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Encrypt passwords for JNDI Resources (Datasource specifically)
From the default distribution of tomcat - there is no way. Just make sure the file is secure. -Tim Jon Wilmoth wrote: I'd like to be able to encrypt the database passwords used in the JDBC pool configuration block. Is this possible in 4.1.27? 5.x? Something as simple as base64 encoding would be fine, I just can't store it as easy to read plain text. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Encrypt passwords for JNDI Resources (Datasource specifically)
I'd like to be able to encrypt the database passwords used in the JDBC pool configuration block. Is this possible in 4.1.27? 5.x? Something as simple as base64 encoding would be fine, I just can't store it as easy to read plain text. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Configuring JNDI LDAP Datasource - NOT USED FOR AUTHENTICATION
How can I declare an LDAP datasource in the server.xml file without the need to use it for authentication. The documentation I have read so far assumes that I am using LDAP for authentication. When looking at the datasources section of the JNDI docs, it assumes a relational database. Can someone give me an example? Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: encrypt passwords for JNDI Resources (Datasource specifically)
Can someone comment on this? I'd really like to know if I can digest the passwords that I use for my configuration in the Server.xml for DBCP Datasources. Is it possible? If not, is it planned? Jake Thursday, August 01, 2002, 1:00:16 PM, you wrote: JK Seems to me someone wrote about this before, but I can't find it. I'm JK wondering if passwords can be digested in JNDI Resource configuration JK just like one can in the Realm configurations? I'd rather not store JK the password for my database in cleartext. The Resource docs don't JK seem to mention anything about digesting passwords. Is it not JK possible? If not now, is this feature planned? I'm using JK Tomcat-4.1.8. JK Jake JK -- JK To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] JK For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Best regards, Jacobmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: encrypt passwords for JNDI Resources (Datasource specifically)
On Fri, 2 Aug 2002, Jacob Kjome wrote: Can someone comment on this? I'd really like to know if I can digest the passwords that I use for my configuration in the Server.xml for DBCP Datasources. Is it possible? If not, is it planned? Thursday, August 01, 2002, 1:00:16 PM, you wrote: JK Seems to me someone wrote about this before, but I can't find it. I'm JK wondering if passwords can be digested in JNDI Resource configuration JK just like one can in the Realm configurations? I'd rather not store JK the password for my database in cleartext. The Resource docs don't JK seem to mention anything about digesting passwords. Is it not JK possible? If not now, is this feature planned? I'm using JK Tomcat-4.1.8. JK Jake I am not really sure what you are talking about, but if you store a password that you will later use to connect to a database, you cannot store a digest. There is no way a program can reproduce the password it needs when connecting if it has just a digest. With digests you can only check that a submitted password produces the same digest. Markus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: encrypt passwords for JNDI Resources (Datasource specifically)
Jacob Kjome wrote: Can someone comment on this? I'd really like to know if I can digest the passwords that I use for my configuration in the Server.xml for DBCP Datasources. Is it possible? If not, is it planned? Jake I will leave it to one of the developers to comment on what may be planned; but I do not think that what you want to do -- protect the uid/pwd data in the config file is currently supported. It looks to me as though the JDBC Datasource provided in Tomcat 4 uses exactly what you have in server.xml to connect to the database. Hashing would add no value here, since the hash would be visible in the config file. If what you really want to do is to protect the uid/pwd info in the file, you need to encrypt (not hash) these data and then create your own resource factory that decrypts before attempting the database connection. I am also curious about what may be in the works here. Are there any plans to support a crypto-enabled version of the commons digester to allow entire config files to be encrypted? Phil Steitz Thursday, August 01, 2002, 1:00:16 PM, you wrote: JK Seems to me someone wrote about this before, but I can't find it. I'm JK wondering if passwords can be digested in JNDI Resource configuration JK just like one can in the Realm configurations? I'd rather not store JK the password for my database in cleartext. The Resource docs don't JK seem to mention anything about digesting passwords. Is it not JK possible? If not now, is this feature planned? I'm using JK Tomcat-4.1.8. JK Jake JK -- JK To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] JK For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
encrypt passwords for JNDI Resources (Datasource specifically)
Seems to me someone wrote about this before, but I can't find it. I'm wondering if passwords can be digested in JNDI Resource configuration just like one can in the Realm configurations? I'd rather not store the password for my database in cleartext. The Resource docs don't seem to mention anything about digesting passwords. Is it not possible? If not now, is this feature planned? I'm using Tomcat-4.1.8. Jake -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
JNDI JDBC DataSource
Does Tomcat 3.2.1 support setting a JDBC DataSource I know that I've seen messages about Tomcat 4.0 supporting it? If so how do I go about setting this up Tomcat 3.2.1? -Ben