tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Joshua A (CASD, IT)" <Joshua.Wh...@thehartford.com>
Subject RE: JNDI datasource frustrations - almost there
Date Fri, 14 Feb 2003 12:42:01 GMT
Thanks for your help Dan.  It seems as though DBCP is having a problem
opening a connection on port 1433.  I wrote a little java class to test out
my url.  It works, no problem!  Here is how it is defined in my server.xml
file:

jdbc:microsoft:sqlserver://localhost:1433

Here is the error that appears in the tomcat console.  Any ideas?

org.apache.commons.dbcp.DbcpException: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.


Stack trace:

[INFO -07:37:46,649[INFO -07:37:46,659DBCP borrowObject failed:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error
establishing s
ocket.
org.apache.commons.dbcp.DbcpException: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
        at
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConne
ctionFactory.java:85)
        at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnect
ionFactory.java:184)
        at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
        at
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool
.java:117)
        at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.ja
va:110)
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3
12)
        at
org.apache.jsp.databasetest_jsp._jspService(databasetest_jsp.java:69)
        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.java:2
04)
        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(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
com.thehartford.casd.comptrak.web.signon.SignOnFilter.doFilter(SignOnFilter.
java:52)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:386)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:530)
        at java.lang.Thread.run(Thread.java:479)














-----Original Message-----
From: Dan Tran [mailto:danttran@hotmail.com]
Sent: Thursday, February 13, 2003 10:32 PM
To: Tomcat Users List
Subject: Re: JNDI datasource frustrations...


his is my sample server.xml

look for glvn key word

Good luck

-Dan
<?xml version='1.0' encoding='utf-8'?>

<Server className="org.apache.catalina.core.StandardServer" debug="0"
port="8005" shutdown="SHUTDOWN">

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>

<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>

<GlobalNamingResources>

<Environment name="simpleValue" override="true" type="java.lang.Integer"
value="30"/>

<Resource auth="Container" description="User database that can be updated
and saved" name="UserDatabase" scope="Shareable"
type="org.apache.catalina.UserDatabase"/>

<Resource name="jdbc/glvn" scope="Shareable" type="javax.sql.DataSource"/>

<ResourceParams name="UserDatabase">

<parameter>

<name>factory</name>

<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>

</parameter>

<parameter>

<name>pathname</name>

<value>conf/tomcat-users.xml</value>

</parameter>

</ResourceParams>

<ResourceParams name="jdbc/glvn">

<parameter>

<name>validationQuery</name>

<value>select ping from ping </value>

</parameter>

<parameter>

<name>maxWait</name>

<value>5000</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>4</value>

</parameter>

<parameter>

<name>username</name>

<value>sa</value>

</parameter>

<parameter>

<name>password</name>

<value></value>

</parameter>

<parameter>

<name>url</name>

<value>jdbc:microsoft:sqlserver://localhost:1433;databaseName=glvn;selectMet
hod=cursor</value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>2</value>

</parameter>

</ResourceParams>

</GlobalNamingResources>

<Service className="org.apache.catalina.core.StandardService" debug="0"
name="Tomcat-Standalone">

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
acceptCount="10" bufferSize="2048" connectionTimeout="20000" debug="0"
enableLookups="true" maxProcessors="75" minProcessors="5" port="8080"
protocolHandlerClassName="org.apache.coyote.http11.Http11Protocol"
proxyPort="0" redirectPort="8443" scheme="http" secure="false"
tcpNoDelay="true" useURIValidationHack="false">

<Factory className="org.apache.catalina.net.DefaultServerSocketFactory"/>

</Connector>

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
acceptCount="10" bufferSize="2048" connectionTimeout="20000" debug="0"
enableLookups="true" maxProcessors="75" minProcessors="5" port="8009"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
proxyPort="0" redirectPort="8443" scheme="http" secure="false"
tcpNoDelay="true" useURIValidationHack="false">

<Factory className="org.apache.catalina.net.DefaultServerSocketFactory"/>

</Connector>

<Engine className="org.apache.catalina.core.StandardEngine" debug="0"
defaultHost="localhost"
mapperClass="org.apache.catalina.core.StandardEngineMapper"
name="Standalone">

<DefaultContext className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

</DefaultContext>

<Host className="org.apache.catalina.core.StandardHost" appBase="webapps"
autoDeploy="true" configClass="org.apache.catalina.startup.ContextConfig"
contextClass="org.apache.catalina.core.StandardContext" debug="0"
deployXML="true"
errorReportValveClass="org.apache.catalina.valves.ErrorReportValve"
liveDeploy="true" mapperClass="org.apache.catalina.core.StandardHostMapper"
name="localhost" unpackWARs="true">

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Tomcat Administration
Application" docBase="../server/webapps/admin"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/admin"
privileged="true" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

<Logger className="org.apache.catalina.logger.FileLogger" debug="0"
directory="logs" prefix="localhost_admin_log." suffix=".txt"
timestamp="true" verbosity="1"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Webdav Content Management"
docBase="C:\JBuilder8\thirdparty\jakarta-tomcat-4.1.12-LE-jdk14\webapps\webd
av" mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/webdav" privileged="false" reloadable="false" swallowOutput="false"
useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Tomcat Examples"
docBase="examples"
mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/examples" privileged="false" reloadable="false" swallowOutput="false"
useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

<Logger className="org.apache.catalina.logger.FileLogger" debug="0"
directory="logs" prefix="localhost_examples_log." suffix=".txt"
timestamp="true" verbosity="1"/>

<Parameter name="context.param.name" override="false"
value="context.param.value"/>

<Ejb home="com.wombat.empl.EmployeeRecordHome" name="ejb/EmplRecord"
remote="com.wombat.empl.EmployeeRecord" type="Entity"/>

<Ejb description="Example EJB Reference"
home="com.mycompany.mypackage.AccountHome" name="ejb/Account"
remote="com.mycompany.mypackage.Account" type="Entity"/>

<Environment name="foo/name4" override="true" type="java.lang.Integer"
value="10"/>

<Environment name="maxExemptions" override="true" type="java.lang.Integer"
value="15"/>

<Environment name="minExemptions" override="true" type="java.lang.Integer"
value="1"/>

<Environment name="foo/bar/name2" override="true" type="java.lang.Boolean"
value="true"/>

<Environment name="name3" override="true" type="java.lang.Integer"
value="1"/>

<Environment name="foo/name1" override="true" type="java.lang.String"
value="value1"/>

<LocalEjb description="Example Local EJB Reference"
home="com.mycompany.mypackage.ProcessOrderHome"
local="com.mycompany.mypackage.ProcessOrder" name="ejb/ProcessOrder"
type="Session"/>

<Resource auth="SERVLET" name="jdbc/EmployeeAppDb" scope="Shareable"
type="javax.sql.DataSource"/>

<Resource auth="Container" name="mail/Session" scope="Shareable"
type="javax.mail.Session"/>

<ResourceParams name="jdbc/EmployeeAppDb">

<parameter>

<name>url</name>

<value>jdbc:HypersonicSQL:database</value>

</parameter>

<parameter>

<name>password</name>

<value></value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>org.hsql.jdbcDriver</value>

</parameter>

<parameter>

<name>username</name>

<value>sa</value>

</parameter>

</ResourceParams>

<ResourceParams name="mail/Session">

<parameter>

<name>mail.smtp.host</name>

<value>localhost</value>

</parameter>

</ResourceParams>

<ResourceLink global="simpleValue" name="linkToGlobalResource"
type="java.lang.Integer"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Giaoly Vietngu Databbase"
docBase="c:\dev\glvn\approot"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/glvn"
privileged="true" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

<Logger className="org.apache.catalina.logger.FileLogger" debug="0"
directory="logs" prefix="localhost_glvn_log." suffix=".txt" timestamp="true"
verbosity="1"/>

<ResourceLink global="jdbc/glvn" name="jdbc/glvn"
type="javax.sql.DataSource"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Tomcat Documentation"
docBase="C:\JBuilder8\thirdparty\jakarta-tomcat-4.1.12-LE-jdk14\webapps\tomc
at-docs" mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/tomcat-docs" privileged="false" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Welcome to Tomcat"
docBase="C:\JBuilder8\thirdparty\jakarta-tomcat-4.1.12-LE-jdk14\webapps\ROOT
" mapperClass="org.apache.catalina.core.StandardContextMapper" path=""
privileged="false" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

</Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="Tomcat Manager Application"
docBase="../server/webapps/manager"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/manager"
privileged="true" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

<Listener className="org.apache.catalina.core.StandardDefaultContext"
cookies="true" crossContext="true" name="defaultContext" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper"/>

<ResourceLink global="UserDatabase" name="users"
type="org.apache.catalina.UserDatabase"/>

</Context>

<Logger className="org.apache.catalina.logger.FileLogger" debug="0"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"
verbosity="1"/>

</Host>

<Logger className="org.apache.catalina.logger.FileLogger" debug="0"
directory="logs" prefix="catalina_log." suffix=".txt" timestamp="true"
verbosity="1"/>

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0"
resourceName="UserDatabase" validate="true"/>

</Engine>

</Service>

</Server>

----- Original Message -----
From: "White, Joshua A (CASD, IT)" <Joshua.White@thehartford.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Thursday, February 13, 2003 6:24 PM
Subject: RE: JNDI datasource frustrations...


> It looks like this is a common problem.  I have found several posts on
> several boards about this problem.  Unfortunately, no solution.
>
> Does it matter whether I declare the resource in the server.xml under the
> global naming resources or do I need to define one specific to my
> applications path?
>
> Has anyone successfully connected with MSSQL Server 2k?
>
> -Joshua
>
> -----Original Message-----
> From: White, Joshua A (CASD, IT)
> Sent: Thursday, February 13, 2003 5:17 PM
> To: 'pqin@shareowner.com'; tomcat-user@jakarta.apache.org
> Subject: RE: JNDI datasource frustrations...
>
>
> Here is my entry in my web.xml:
>
>   <resource-ref>
>       <description>Sql Server Database Connection</description>
>       <res-ref-name>jdbc/joshsDB</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>
>
> I am still at a loss.  Any other ideas?
>
> -Joshua
>
>
>
>
>
>
> -----Original Message-----
> From: pqin@shareowner.com [mailto:pqin@shareowner.com]
> Sent: Thursday, February 13, 2003 3:43 PM
> To: tomcat-user@jakarta.apache.org
> Subject: RE: JNDI datasource frustrations...
>
>
> What about your app's web.xml? This is a classic question, You many search
> through this list or struts/commons lists for answer. There is also a
> documentation on Jakarta.apache.org's.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -----Original Message-----
> From: White, Joshua A (CASD, IT) [mailto:Joshua.White@thehartford.com]
> Sent: February 13, 2003 3:36 PM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: JNDI datasource frustrations...
>
> All,
>
> It seems that I may be having a problem instantiating the Sql server jdbc
> driver.  I have copied the following jars into my
$CATALINA_HOME/common/lib
> directory:
> msbase.jar
> mssqlserver.jar
> msutil.jar
>
>
> I have the following in my server.xml file:
>
>             <Resource name="jdbc/joshsDB"
>                 auth="Container"
>                 type="javax.sql.DataSource"/>
>
>
> <ResourceParams name="jdbc/joshsDB">
>     <parameter>
>         <name>username</name>
>         <value>someuser</value>
>     </parameter>
>     <parameter>
>         <name>password</name>
>         <value>password</value>
>     </parameter>
>     <parameter>
>         <name>driverClassName</name>
>         <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
>     </parameter>
>     <parameter>
>         <name>url</name>
>         <value>jdbc:microsoft:sqlserver://localhost:1433</value>
>     </parameter>
>     <parameter>
>         <name>maxActive</name>
>         <value>100</value>
>     </parameter>
>     <parameter>
>         <name>maxIdle</name>
>         <value>10000</value>
>     </parameter>
>     <parameter>
>         <name>maxWait</name>
>         <value>10000</value>
>     </parameter>
> </ResourceParams>
>
>
> In the Tomcat console, I see the following:
>
> java.sql.SqlException: Cannot load JDBC driver class 'null'
>
> What am I doing wrong here?
>
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message