i have been developing using WSAD to use connection pooling and has been very 
successful.   However, once we moved our application to Linux, I am getting the 
exception message "javax.naming.NamingException: Cannot create resource instance"  I 
think lot of people worked on this part of connection pooling aware of this problem 
very well, because I spent quite amount of time on this issue and saw many people with 
this issue.

Configuration wise, /common/lib/common jars file locations wise, everything works out 
fine for me.  I don't see any issue with my configuration now after so much time spent 
on this issue and it works fine in WSAD(of course, there are some issues related with 
that too).   

Now, the question is... 
1.  when i did check the resourceRef, i don't see all ResourceParams parameters i did 
define in my server.xml.  Such as defaultMaxActive, dataSourceName and so on do not 
appear in the ResourceRef.   However, if u check ResourceRef during Tomcat 
initialization process, it shows all the parameters in ResourceParams.

2.  So, i am getting to ask u guys, is this another bug?  I am going to spend another 
weekends for this problme, it looks that ResourceFactory does not read in all the 
necessary parameters when it is invoked by 
javax.naming.spi.NamingManager.getObjectInstance...



If anybody solved this kind of the problem, i would appreciate you sharing your pains.

many thanks in advance,....


chao.



Using PerUserPoolDataSource is required for our own business requirement.

Server.xml..
 <Resource auth="Container" name="jdbc/DC1DEVCPDS" 
type="org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS"/>
        <ResourceParams name="jdbc/DC1DEVCPDS">
        
<parameter><name>factory</name><value>org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS</value></parameter>
        <parameter><name>user</name><value><value/></parameter>
        <parameter><name>password</name><value/></parameter>
        
<parameter><name>driver</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>
        
<parameter><name>url</name><value>jdbc:oracle:thin:@mydatabase:1521:DC1DEV</value></parameter>
</ResourceParams>
-> 

<Resource auth="Container" name="jdbc/DC1DEV" 
type="org.apache.commons.dbcp.datasources.PerUserPoolDataSource"/>

<ResourceParams 
name="jdbc/DC1DEV"><parameter><name>factory</name><value>org.apache.commons.dbcp.datasources.PerUserPoolDataSourceFactory</value></parameter>

<parameter><name>defaultMaxActive</name><value>10</value></parameter>

<parameter><name>defaultMaxIdle</name><value>5</value></parameter>

<parameter><name>defaultMaxWait</name><value>10000</value></parameter>

<parameter><name>dataSourceName</name><value>java:comp/env/jdbc/DC1DEVCPDS</value></parameter>

</ResourceParams>

web.xml

<resource-ref><description>DC1DEV</description><res-ref-name>jdbc/DC1DEV</res-ref-name><res-type>org.apache.commons.dbcp.datasources.PerUserPoolDataSource</res-type><res-auth>Container</res-auth><res-sharing-scope>Shareable</res-sharing-scope></resource-ref>
 

<resource-ref><description>DC1DEVCPDS</description><res-ref-name>jdbc/DC1DEVCPDS</res-ref-name><res-type>org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS</res-type><res-auth>Container</res-auth></resource-ref>



[22 May 2004 11:42:22,215] INFO  [TP-Processor2] locator.ServiceLocator [] -> Binding 
object
[22 May 2004 11:42:22,216] INFO  [TP-Processor2] locator.ServiceLocator [] -> 
ResourceRef:
ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory 
ClassName=org.apache.naming.factory.ResourceFactory,{type=description,content=simpleDS},{type=scope,content=Shareable},{type=auth,content=Container}]
[22 May 2004 11:42:22,216] INFO  [TP-Processor2] locator.ServiceLocator[] -> next
[22 May 2004 11:42:22,217] INFO  [TP-Processor2] locator.ServiceLocator[] -> Binding : 
*****
[22 May 2004 11:42:22,217] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
DC1DEVCPDS:
org.apache.naming.ResourceRef:ResourceRef[className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS,factoryClassLocation=null,factoryClassName=org
.apache.naming.factory.ResourceFactory,{type=description,content=DC1DEVCPDS},{type=scope,content=Shareable},{type=auth,content=Container}]
[22 May 2004 11:42:22,217] INFO  [TP-Processor2] locator.ServiceLocator[] -> Binding 
object
[22 May 2004 11:42:22,218] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
ResourceRef:
ResourceRef[className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.Resourc
eFactory,{type=description,content=DC1DEVCPDS},{type=scope,content=Shareable},{type=auth,content=Container}]
[22 May 2004 11:42:22,218] INFO  [TP-Processor2] locator.ServiceLocator[] -> next
[22 May 2004 11:42:22,218] INFO  [TP-Processor2] locator.ServiceLocator[] -> Binding : 
*****
[22 May 2004 11:42:22,219] INFO  [TP-Processor2] locator.ServiceLocator[] -> DC1DEV:
org.apache.naming.ResourceRef:ResourceRef[className=org.apache.commons.dbcp.datasources.PerUserPoolDataSource,factoryClassLocation=null,factoryClassName
=org.apache.naming.factory.ResourceFactory,{type=description,content=DC1DEV},{type=scope,content=Shareable},{type=auth,content=Container}]
[22 May 2004 11:42:22,219] INFO  [TP-Processor2] locator.ServiceLocator[] -> Binding 
object
[22 May 2004 11:42:22,220] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
ResourceRef:
ResourceRef[className=org.apache.commons.dbcp.datasources.PerUserPoolDataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.Res
ourceFactory,{type=description,content=DC1DEV},{type=scope,content=Shareable},{type=auth,content=Container}]
[22 May 2004 11:42:22,220] INFO  [TP-Processor2] locator.ServiceLocator[] -> next
[22 May 2004 11:42:22,221] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
****************************for JNDI Test ends:
[22 May 2004 11:42:22,221] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
java:/comp/env/jdbc/DC1DEV
[22 May 2004 11:42:22,221] INFO  [TP-Processor2] locator.ServiceLocator[] -> 
******start to lookup
[22 May 2004 11:42:22,229] ERROR [TP-Processor2] locator.ServiceLocator[] -> 
ServiceLocator.getDataStoresMap.
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:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
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)

Reply via email to