If anyone can shed some light on this problem I would greatly
appreciate it.
I am unsuccessfully trying to use a database connnection retrieved
from a pool configured using Java System Web Server 6.1 with the SQL
Server 2000 JDBC Driver.
The background:
1. I have downloaded the SQL Server 2000 JDBC Driver and installed it
on the web server.
2. I used the Administration GUI to add the .jars(namely msbase.jar,
msutil.jar, and mssqlserver.jar), to the classpath.
3. Upon creating a simple JSP to access connection metadata using the
direct connect method, ie.,
Class.forName( com.microsoft.jdbc.sqlserver.SQLServerDriver);
Connection con = DriverManager.getConnection(
"jdbc:microsoft:sqlserver:// ....
I am shown a successful output of...
JDBC Test
Registering JDBC Driver
driverClass: com.microsoft.jdbc.sqlserver.SQLServerDriver loaded and
registered.
Driver Information
Driver Name: SQLServer
Driver Version: 2.2.0037
Database Information
Database Name: Microsoft SQL Server
Database Version: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec
17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.2 (Build 3790: )
Avalilable Catalogs
catalog: master
catalog: msdb
catalog: Northwind
catalog: pubs
catalog: tempdb
4. This tells me that the web server has access to the files necessary
and the classpath is configured correctly.
Now the fun begins...
In order to set up the JDBC Connection Pool I have done the
following...
1. I have created a web.xml file for the web-app which contains the
JSP and includes the following entry
<resource-ref>
<res-ref-name>jdbc/devjwscp</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
2. I have used the "JDBC Connection Pools" link under the "Java" tab
in the Administration GUI to create a connection pool.
"Pool Name:" is "devjwscp"
"DataSource Classname" is set to
"com.microsoft.jdbcx.sqlserver.SQLServerDataSource ". All other
properties have been left alone.
3. I have used the "JDBC Resources" link under the "Java" tab in the
Administration GUI to create a JNDI resource.
"JNDI Name" is set to "jdbc/devjwscp"
"Status" is "true"
"Pool Name" is "devjwscp"
The web-app JSP comes back with the following exception.
JDBC Test
Exception Thrown
Cannot create resource instance
javax.naming.NamingException: Cannot create resource
instanceorg.apache.naming.factory.ResourceFactory. getObjectInstance(ResourceFactory.java:167)
javax.naming.spi.NamingManager.getObjectInstance(N amingManager.java:301)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:834)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:194)
org.apache.naming.SelectorContext.lookup(SelectorC ontext.java:183)
javax.naming.InitialContext.lookup(InitialContext. java:347)
_jsps._jdbctest_jsp._jspService(_jdbctest_jsp.java :236)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:107)
javax.servlet.http.HttpServlet.service(HttpServlet .java:908)
com.iplanet.ias.web.jsp.JspServlet$JspServletWrapp er.service(JspServlet.java:667)
com.iplanet.ias.web.jsp.JspServlet.serviceJspFile( JspServlet.java:447)
com.iplanet.ias.web.jsp.JspServlet.service(JspServ let.java:363)
javax.servlet.http.HttpServlet.service(HttpServlet .java:908)
org.apache.catalina.core.StandardWrapperValve.invo keServletService(StandardWrapperValve.java:771)
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:322)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:212)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:209)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor .process(NSAPIProcessor.java:161)
com.iplanet.ias.web.WebContainer.service(WebContai ner.java:586)
4. FYI my server.xml <RESOURCE> entry looks as is shown below
<RESOURCES>
<JDBCCONNECTIONPOOL name="devjwscp"
datasourceclassname="com.microsoft.jdbcx.sqlserver .SQLServerDataSource"
steadypoolsize="8" maxpoolsize="32" poolresizequantity="2"
idletimeout="300" maxwaittime="60000"
connectionvalidationrequired="off"
connectionvalidationmethod="auto-commit" validationtablename=""
failallconnections="off" transactionisolationlevel="read-uncommitted"
isolationlevelguaranteed="off">
<PROPERTY name="serverName" value="..."/>
<PROPERTY name="portNumber" value="1433"/>
<PROPERTY name="User" value="..."/>
<PROPERTY name="Password" value="..."/>
</JDBCCONNECTIONPOOL>
<JDBCRESOURCE jndiname="jdbc/devjwscp" poolname="devjwscp"
enabled="on"/>
</RESOURCES>
Code snippet... should look familiar to you all...
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/devjwscp");
Connection poolConn = ds.getConnection();
What gives? Do I need to add anything else to the server.xml? I know
the server.xml for JWS differs from Apache. I have done an exhaustive
search of the web. Many other individuals have had the same thing
happen, but none of them offered any explaination or remedy.
Do I need to incorporate a sub-web.xml file entry as a solution?
Thanks in advance.
Jason