You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim <tt...@mailhost.net> on 2001/12/01 00:24:15 UTC

findDataSource

Here's my setup:
MacOS X
Tomcat 4 (but also happens with orion)
MySQL 3.23.43

     <data-sources>
       <data-source>
         <set-property property="driverClass" value="org.gjt.mm.mysql.Driver" />
         <set-property property="password" value="root" />
         <set-property property="user" value="root" />
         <set-property property="url" value="jdbc:mysql://127.0.0.1:3306/eds" />
       </data-source>
     </data-sources>

Everything works fine, until I run the following piece of code:

       DataSource dataSource = servlet.findDataSource(null);
       Connection conn = dataSource.getConnection();

findDataSource gives me this error:

	java.lang.NullPointerException

I presume it can't find the datasource. Howevere, I know that the mm 
driver is working fine and it can contact the database, since the 
application is at least able to startup.

Can anyone figure out what's happening?
-- 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: findDataSource

Posted by Chris Birch <ch...@artlas.net>.
Tim,

I'm running MacOS X, Tomcat 4 too but with postgres RDBMS.  My 
datasource set-up in Struts config is diiferent though, I see yours is 
the same as the example given in the struts-example.  I lifted mine from 
the user guide and it works just fine.

   <data-sources>
     <data-source
         autoCommit="false"
         description="Data Source Configuration"
         driverClass="org.postgresql.Driver"
         maxCount="6"
         minCount="2"
         password="password"
         url="jdbc:postgresql://127.0.0.1:5432/myDB"
         user="user"
     />
   </data-sources>

I don't know which is valid or if they both should work.  (Still getting 
to grips with Struts1.0 so could be a feature of 1.1?).

Regards,
Chris.

On Friday, November 30, 2001, at 11:24  pm, Tim wrote:

> Here's my setup:
> MacOS X
> Tomcat 4 (but also happens with orion)
> MySQL 3.23.43
>
>     <data-sources>
>       <data-source>
>         <set-property property="driverClass" 
> value="org.gjt.mm.mysql.Driver" />
>         <set-property property="password" value="root" />
>         <set-property property="user" value="root" />
>         <set-property property="url" 
> value="jdbc:mysql://127.0.0.1:3306/eds" />
>       </data-source>
>     </data-sources>
>
> Everything works fine, until I run the following piece of code:
>
>       DataSource dataSource = servlet.findDataSource(null);
>       Connection conn = dataSource.getConnection();
>
> findDataSource gives me this error:
>
> 	java.lang.NullPointerException
>
> I presume it can't find the datasource. Howevere, I know that the mm 
> driver is working fine and it can contact the database, since the 
> application is at least able to startup.
>
> Can anyone figure out what's happening?
> --
> --
> To unsubscribe, e-mail:   <mailto:struts-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-
> help@jakarta.apache.org>
>