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 serverXXXX.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 maaaaany 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="60000" 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> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS</value> </parameter> <parameter> <name>username</name> <value>SGC_CNID</value> </parameter> <parameter> <name>password</name> <value>****</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>maxActive</name> <value>20</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</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 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) ..... This is what the log (through JBuilder console) looks like when starting-up the server: C:\jdk1.3.1_11\bin\javaw -classpath "C:\JBuilderX\thirdparty\jakarta-tomcat-4.1.27-LE-jdk14\bin\bootstrap.ja r;C:\JBuilderX\extras\xalan\bin\xalan.jar;C:\JBuilderX\lib\xercesImpl.ja r;C:\JBuilderX\lib\xmlParserAPIs.jar;C:\jdk1.3.1_11\lib\tools.jar" -Dcatalina.home="C:/JBuilderX/thirdparty/jakarta-tomcat-4.1.27-LE-jdk14" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=bm3012:1750,suspend=y org.apache.catalina.startup.Bootstrap -config "C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\conf\server8080.xml" start [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.27-LE-jdk14 StandardContext[wa]: Starting StandardContext[wa]: Processing start(), current available=false StandardContext[wa]: Configuring default Resources StandardContext[wa]: Configuring non-privileged default Loader StandardContext[wa]: Configuring default Manager StandardContext[wa]: Processing standard container startup WebappLoader[wa]: Deploying class repositories to work directory C:\JBuilderX\thirdparty\jakarta-tomcat-4.1.27-LE-jdk14\work\Standalone\l ocalhost\wa WebappLoader[wa]: Deploy class files /WEB-INF/classes to C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps\..\..\Testing\WEB-INF\classes WebappLoader[wa]: Reloading checks are enabled for this Context ContextConfig[wa]: ContextConfig: Processing START StandardContext[wa]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' StandardContext[wa]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' ContextConfig[wa]: Accumulating TLD resource paths ContextConfig[wa]: Scanning <taglib> elements in web.xml ContextConfig[wa]: Scanning TLDs in /WEB-INF subdirectory ContextConfig[wa]: Scanning JARs in /WEB-INF/lib subdirectory ContextConfig[wa]: Pipline Configuration: ContextConfig[wa]: org.apache.catalina.core.StandardContextValve/1.0 ContextConfig[wa]: ====================== NamingContextListener[/Standalone/localhostwa]: Creating JNDI naming context NamingContextListener[/Standalone/localhostwa]: Resource parameters for jdbc/cnid = ResourceParams[name=jdbc/cnid, parameters={factory=org.apache.commons.dbcp.BasicDataSourceFactory, maxWait=-1, maxActive=20, password=****, url=jdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS, driverClassName=oracle.jdbc.driver.OracleDriver, maxIdle=10, username=SGC_CNID}] NamingContextListener[/Standalone/localhostwa]: Adding resource ref jdbc/cnid NamingContextListener[/Standalone/localhostwa]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,fac toryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,cont ent=Shareable},{type=factory,content=org.apache.commons.dbcp.BasicDataSo urceFactory},{type=maxWait,content=-1},{type=maxActive,content=20},{type =password,content=****},{type=url,content=jdbc:oracle:thin:@BMSRVORACLE: 1521:BMSRVMS},{type=driverClassName,content=oracle.jdbc.driver.OracleDri ver},{type=maxIdle,content=10},{type=username,content=SGC_CNID}] NamingContextListener[/Standalone/localhostwa]: Resource parameters for UserTransaction = null StandardManager[wa]: Seeding random number generator class java.security.SecureRandom StandardManager[wa]: Seeding of random number generator has been completed StandardContext[wa]: Posting standard context attributes StandardContext[wa]: Configuring application event listeners StandardContext[wa]: Sending application start events StandardContext[wa]: Starting filters StandardWrapper[wa:default]: Loading container servlet default StandardWrapper[wa:invoker]: Loading container servlet invoker StandardContext[wa]: Starting completed StandardContext[]: Starting StandardContext[]: Processing start(), current available=false StandardContext[]: Configuring default Resources StandardContext[]: Configuring non-privileged default Loader StandardContext[]: Configuring default Manager StandardContext[]: Processing standard container startup WebappLoader[]: Deploying class repositories to work directory C:\JBuilderX\thirdparty\jakarta-tomcat-4.1.27-LE-jdk14\work\Standalone\l ocalhost\_ WebappLoader[]: Deploy class files /WEB-INF/classes to C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\webapps\..\..\Testing\WEB-INF\classes WebappLoader[]: Reloading checks are enabled for this Context ContextConfig[]: ContextConfig: Processing START StandardContext[]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' StandardContext[]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' ContextConfig[]: Accumulating TLD resource paths ContextConfig[]: Scanning <taglib> elements in web.xml ContextConfig[]: Scanning TLDs in /WEB-INF subdirectory ContextConfig[]: Scanning JARs in /WEB-INF/lib subdirectory ContextConfig[]: Pipline Configuration: ContextConfig[]: org.apache.catalina.core.StandardContextValve/1.0 ContextConfig[]: ====================== NamingContextListener[/Standalone/localhost]: Creating JNDI naming context NamingContextListener[/Standalone/localhost]: Resource parameters for jdbc/cnid = null NamingContextListener[/Standalone/localhost]: Adding resource ref jdbc/cnid NamingContextListener[/Standalone/localhost]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,fac toryClassName=org.apache.naming.factory.ResourceFactory,{type=descriptio n,content=El Datasource XXX},{type=scope,content=Shareable},{type=auth,content=Container}] NamingContextListener[/Standalone/localhost]: Resource parameters for UserTransaction = null StandardManager[]: Seeding random number generator class java.security.SecureRandom StandardManager[]: Seeding of random number generator has been completed StandardContext[]: Posting standard context attributes StandardContext[]: Configuring application event listeners StandardContext[]: Sending application start events StandardContext[]: Starting filters StandardWrapper[:default]: Loading container servlet default StandardWrapper[:invoker]: Loading container servlet invoker StandardContext[]: Starting completed HostConfig[localhost]: HostConfig: Processing START HostConfig[localhost]: Deploying discovered web applications HostConfig[localhost]: Deploying configuration descriptor jb-wa.xml WebappLoader[/wa]: Deploying class repositories to work directory C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Tomcat\work\wa WebappLoader[/wa]: Deploy class files /WEB-INF/classes to C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso a datos\Testing\WEB-INF\classes WebappLoader[/wa]: Reloading checks are enabled for this Context StandardManager[/wa]: Seeding random number generator class java.security.SecureRandom StandardManager[/wa]: Seeding of random number generator has been completed StandardWrapper[/wa:default]: Loading container servlet default StandardWrapper[/wa:invoker]: Loading container servlet invoker HostConfig[localhost]: Starting background thread EngineConfig: EngineConfig: Processing START HostConfig[localhost]: BACKGROUND THREAD Starting [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080 StandardEngine[Standalone]: Mapping server name '127.0.0.1' StandardEngine[Standalone]: Trying a direct match StandardEngine[Standalone]: Trying an alias match StandardEngine[Standalone]: Trying the default host StandardHost[localhost]: Mapping request URI '/' StandardHost[localhost]: Trying the longest context path prefix StandardEngine[Standalone]: Mapping server name '127.0.0.1' StandardEngine[Standalone]: Trying a direct match StandardEngine[Standalone]: Trying an alias match StandardEngine[Standalone]: Trying the default host StandardHost[localhost]: Mapping request URI '/' StandardHost[localhost]: Mapped to context '' StandardHost[localhost]: Trying the longest context path prefix StandardContext[]: Mapping contextPath='' with requestURI='/' and relativeURI='/' StandardContext[]: Trying exact match StandardContext[]: Trying prefix match StandardHost[localhost]: Mapped to context '' StandardContext[]: Trying extension match StandardContext[]: Mapping contextPath='' with requestURI='/' and relativeURI='/' StandardContext[]: Trying default match StandardContext[]: Trying exact match StandardContext[]: Trying prefix match StandardContext[]: Mapped to servlet 'default' with servlet path '/' and path info 'null' and update=true StandardContext[]: Trying extension match StandardContext[]: Trying default match StandardContext[]: Mapped to servlet 'default' with servlet path '/' and path info 'null' and update=true HostConfig[localhost]: Deploying discovered web applications HostConfig[localhost]: Deploying discovered web applications HostConfig[localhost]: Deploying discovered web applications HostConfig[localhost]: Deploying discovered web applications What is going on here??????? I've been working with tomcat for a long time, yet had never faced this problem... I'm baffled, yet convinced it has to be something so silly I'm overlooking it!!! HELP, PLEASE! Thanks in advance, Freddy. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]