You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Mateo A. Ortega" <pe...@yahoo.com> on 2001/09/29 00:12:49 UTC
Help: Custom Resource Factory Class
Hello,
I have been banging my head on this for two days, I am
guessing somebody else has done this successfully
(although searches in the archive & usenet come up
empty).
I am using Tomcat 4.0 and I am trying to use a
non-tyrex datasource. According to the docs I have to
create my own ObjectFactory and modify the web.xml &
server.xml, but I keep getting
"javax.naming.NamingException: Cannot create resource
instance".
This was with Opta2K and a ObjectFactory I wrote. I
noticed Micro$ has a beta version of Merant and it
includes SQLServerDataSourceFactory, so I put this
following in web.xml:
<resource-env-ref>
<description>blah</description>
<resource-env-ref-name>jdbc/db</resource-env-ref-name>
<resource-env-ref-type>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</resource-env-ref-type>
</resource-env-ref>
And in server.xml I put:
<ResourceParams name="jdbc/db">
<parameter>
<name>user</name>
<value>myuser</value>
</parameter>
<parameter>
<name>password</name>
<value>mypassword</value>
</parameter>
<parameter>
<name>serverName</name>
<value>127.0.0.1</value>
</parameter>
<parameter>
<name>databaseName</name>
<value>mydb</value>
</parameter>
</ResourceParams>
But I still get "javax.naming.NamingException: Cannot
create resource instance", when I do a lookup [I have
verified that the entry is there ("XmlMapper:
org.apache.catalina.core.StandardContext.addResourceEnvRef(
jdbc/db,
com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory)"]
I have been able to connect to the db with both
drivers w/o a problem, but this is driving me crazy.
Any help is appreciated.....tia
__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com