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]

