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
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
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]