You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Radoslaw Adamiak <ra...@gmail.com> on 2007/08/15 13:50:04 UTC

[axis2] Problem with setting DataSource

Hi
I'm not sure if this is axis2 problem (and in fact - is this the right
place to send this post), but I think so.

I have problem with setting datasource(DS) in Apache Tomcat 5.0.
I have read manuals:
http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
http://tomcat.apache.org/tomcat-5.0-doc/config/globalresources.html
On Tomcat side I think it's ok - tomcat admin shows configured DS
(without any errors).
But axis2 doesn't see it (exactly: lookup in axis2 services for DS
can't find it).

server.xml:
...
<Resource name="jdbc/dw" type="javax.sql.DataSource" auth="Container" />
    <ResourceParams name="jdbc/dw">
      <parameter>
        <name>url</name>
        <value>jdbc:mysql://localhost:3306/dw</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>p</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.mysql.jdbc.Driver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>u</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>
...

axis2's web.xml:
...
    <resource-ref>
        <description>Connection Pool</description>
        <res-ref-name>jdbc/dw</res-ref-name>
        <res-type>javax.sql.Datasource</res-type>
        <res-auth>Container</res-auth>
  </resource-ref>
...

axis2's context.xml:
...
  <ResourceLink name="jdbc/dw" global="jdbc/dw" type="javax.sql.DataSource" />
...

code:
 = null;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup( "java:/comp/env" );
DataSource ds = (DataSource) envCtx.lookup( "jdbc/dw" );
Connection conn = ds.getConnection();

is it needed something more/less in my configs?
please help

-- 
zolv


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org