Hi Jiri,
People always want to help on this list, so I suspect that it is the question. A nullpointer exception is very unhelpful with information. Are you sure that you have the database up and running? Have you tested the JDBC connection on any other database? Or the database with any other web app?



Adam



On 08/13/2003 02: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]



-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9


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



Reply via email to