You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aleksandr Shneyderman <al...@law.columbia.edu> on 2002/12/12 15:59:58 UTC
Custom resource Factory problem
(tomcat 4.1.16)
I was trying to create a custom resource factory and
get the following exception:
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:189)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:57)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
...
----------------- I have in my server xml inside
----------------- GlobalNamingResources:
<Resource
name="jdbc/local_gls"
auth="Container"
type="java.lang.String"
description="GLS test">
</Resource>
<ResourceParams name="jdbc/local_gls">
<parameter>
<name>factory</name>
<value>edu.columbia.law.naming.CPResourceFactory</value>
</parameter>
<parameter><name>Config</name><value>test.xml</value></parameter>
</ResourceParams>
--------------- my web.xml has the following:
<resource-ref>
<description>GLS DB</description>
<res-ref-name>jdbc/local_gls</res-ref-name>
<res-type>java.lang.String</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
--------------- my test jsp page has the following code:
<% String ds = "";
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds = (String) envCtx.lookup("jdbc/local_gls");
} catch (Exception e) {
e.printStackTrace (); %>
Exception type: <%= e.getClass ().getName () %><br>
Exception message: <%= e.getMessage () %><br>
<% } %>
---------- my edu.columbia.law.naming.CPResourceFactory
---------- has the following code:
public class CPResourceFactory implements ObjectFactory {
public Object getObjectInstance (
Object obj, Name name,
Context nameCtx, Hashtable environment) throws
NamingException {
return new String ("Empty String");
}
}
does anybody know what is wrong with my config?
Thanks,
Alex.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>