Use data-sources.xml instead.   Just a suggestion.
If I remember right, there has been talk that future Struts releases won't
support datasources anyway.

http://marc.theaimsgroup.com/?l=struts-user&m=105372428318434&w=2


On Wednesday, August 13, 2003, at 01:50 PM, Jiri Chaloupka wrote:

> Is it so simply you do not want to help or nobody knows? ...
>
> Jiri Chaloupka wrote:
>
>> Hallo,
>> I cannot get DataSource in Struts.
>>
>> in my strits-config.xml file is configured:
>> <data-source type="org.apache.commons.dbcp.BasicDataSource">
>>    <set-property
>>      property="driverClassName"
>>      value="oracle.jdbc.driver.OracleDriver" />
>>    <set-property
>>      property="url"
>>      value="jdbc:oracle:thin:@chaloupkaj.iccc.cz:1521:ordb" />
>>    <set-property
>>      property="username"
>>      value="xxx" />
>>    <set-property
>>      property="password"
>>      value="xxx" />
>>    <set-property
>>      property="maxActive"
>>      value="10" />
>>    <set-property
>>      property="maxWait"
>>      value="5000" />
>>    <set-property
>>      property="defaultAutoCommit"
>>      value="false" />
>>    <set-property
>>      property="defaultReadOnly"
>>      value="false" />
>>   </data-source>
>>
>> and in my code:
>> public class TestList extends Action{
>>    HttpServletRequest request = null;
>> ...
>> public int getList() throws Exception
>>    {
>>     DataSource ds = null;
>>      ....
>>      try{
>>            try{
>>                // try request object
>>                res.append("URI is "+request.getContextPath()+"<br>");
>>            }catch(Exception e){
>>                res.append("something wrong with request!!! <br>");
>>            }
>>            try{
>>                              ds = this.getDataSource(request);
>>                res.append("datasource ok <br>");
>>            }catch(Exception e){
>>                res.append("cannot get datasource!!! <br>");
>>                res.append("Fail: "+e.toString());
>>            }
>>
>> etc...
>>
>> and displays:
>> URI is /blabla
>> cannot get datasource!!!
>> Fail. : java.lang.NullPointerException
>>
>> Is there anything else I must configure, or I badly undestand 
>> something else?
>> Or is there another way to do it better? I am new in Struts, reading 
>> manual,  I was order some book (Programming Struts) but this book 
>> does not deliveder yet...
>> I cannot use Hibernate for this project becouse data into database 
>> will be writen by another way and as I understand hibernate layer 
>> should not know about its changes.
>>
>> Thanks
>> Jiri
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to