Servlet decument says: getDatasource(HTTPServletRequest) is used to get the 
default datasource, getDataSource(HttpServletRequest, String) get the selected 
datasource. However, since I am using struts. following instruction in tomcat 
documentation on connection pooling and using getDatasource within a struts 
action class give a null resource because although action class has 
getDatasource(HttpServletRequest) as the httpServlet class, it only return 
resource which is managed by strut not the from container as the httpServlet 
object does.
I'm now letting struts manages the resource. My problem is partly solved for 
now.
Thanks for your suggestion
Thai
David Smith <[EMAIL PROTECTED]> wrote: Not knowing how this code is working:

  DataSource ds = this.getDataSource(request,"jdbc/TestDB");
 > if(ds == null)
 >     throw new InternalException("datasource is null");

I'm not sure what to tell you.  The method getDataSource( request, 
"jdbc/TestDB" ) is not a part of tomcat or the servlet spec.  Is it part 
of Struts?

--David

Nhut Thai Le wrote:
> You are definitely right, i was sleepy while posting the question. The 1.2.9 
> is the struts version. The bundles tomcat is 5.5.17. But is it the cause of 
> my problem? 
>
> David Smith  wrote: Tomcat 1.2.9???  I doubt that's the real version number.  
> Typical 
> version numbers are 4.x, 5.0.x, 5.5.x, or 6.0.x.  I think Netbeans 
> bundles started with 5.0.x later upgraded to 5.5.x with Netbeans 5.5.  
> Could you take another look?
>
> --David
>
> Nhut Thai Le wrote:
>   
>> Hi guys,
>>   I 'm developing a simple web app with netbeans with bundle tomcat 1.2.9. I 
>> want to use connection pooling fir my web app. Thus, i config as follow:
>>    
>>   Here is my server.xml:
>>
>>   
>> And here is my WEB-INF/web.xml
>>
>>   
>>
>>     
>>         AccessControl
>>         com.core1.filter.AccessControl
>>
>>    
>>     
> loginPage
>
>   
>>    
>>     
> /WEB-INF/authentication/login.jsp
>
>   
>>     
>>     
>>         AccessControl
>>         /protected/*
>>     
>>     
>>     
>
>   
>>        
>>     
> com.core1.listener.ResourceManagerListener
>   
>>     
>>     
>>         action
>>         org.apache.struts.action.ActionServlet
>>         
>>             
>>     
> config
>
>   
>>             
>>     
> /WEB-INF/struts-config.xml
>
>   
>>         
>>         
>>             
>>     
> debug
>
>   
>>             
>>     
> 2
>
>   
>>         
>>         
>>             
>>     
> detail
>
>   
>>             
>>     
> 2
>
>   
>>         
>>         2
>>     
>>     
>>         action
>>         *.do
>>     
>>     
>>         
>>             30
>>         
>>     
>>     
>>
>>             index.jsp
>>         
>>     
>>     
>>         Exception
>>         /WEB-INF/error/error.jsp
>>     
>>     
>>         DB connection
>>         jdbc/TestDB
>>         javax.sql.DataSource
>>         Container
>>     
>>
>>   
>> I assume that by referencing the DataSource in WEB-INF/web.xml to the 
>> DataSource initialized in server.xml, I can access the Datasource from 
>> anywhere. However, in one of my Action Class(i'm using Struts framework) I 
>> have the following code
>>    
>>   DataSource ds = this.getDataSource(request,"jdbc/TestDB");
>> if(ds == null)
>>     throw new InternalException("datasource is null");
>>   
>> Supprisingly, the exception is thrown! The DataSource is null after all.Is 
>> there anything else i have to do? It's been 2 weeks i have stuck with this 
>> problem. Hope anyone can give a suggestion
>>    
>>   Thai
>>
>>
>> -------------------------
>> Where there's will, there's a way
>>  
>> ---------------------------------
>> We won't tell. Get more on shows you hate to love
>> (and love to hate): Yahoo! TV's Guilty Pleasures list.
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> -------------------------
> Where there's will, there's a way
>        
> ---------------------------------
> Looking for a deal? Find great prices on flights and hotels with Yahoo! 
> FareChase.
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-------------------------
Where there's will, there's a way
       
---------------------------------
Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

Reply via email to