tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: JNDI configuration in server.xml
Date Wed, 22 Oct 2003 15:41:54 GMT

Howdy,
I thought you needed a <Resource name="component" ... /> before
<ResourceParams name="component"> ... </ResourceParams>...

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Galbayar [mailto:galbayar@mobinet.mn]
>Sent: Wednesday, October 22, 2003 2:44 AM
>To: Tomcat Users List
>Subject: JNDI configuration in server.xml
>
>I have component deployed in common/lib/component.jar and configured
many
>webapplications
>each webapplication use global component through JNDI and my
configuration
>in server.xml is
>
><GlobalNamingResources>
><Resource name="vasLogger" auth="Container"
type="javax.sql.DataSource"/>
>
>  <ResourceParams name="component">
>    <parameter>
>      <name>factory</name>
>      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>    </parameter>
>
>    <parameter>
>      <name>maxActive</name>
>      <value>100</value>
>    </parameter>
>
>    <parameter>
>      <name>maxIdle</name>
>      <value>30</value>
>    </parameter>
>
>    <parameter>
>      <name>maxWait</name>
>      <value>10000</value>
>    </parameter>
>
>  </ResourceParams>
>....
></GlobalNamingResources>
>
>Servlet calling components method example is but it doesnot work What
>happened?
>
>public void CallJNDIContext {
>        InitialContext iCtx = null;
>        Context ctx = null;
>
>        try {
>            iCtx = new InitialContext();
>            ctx = (Context) iCtx.lookup("java:comp/env");
>
>            if (ctx != null) {
>                DataSource ds = (DataSource)
ctx.lookup("jdbc/component");
>
>                if (ds != null) {
>                    connection = ds.getConnection();
>                }
>            }
>        } catch (NamingException e) {
>		e.printStackTrace();
>        } catch (SQLException e) {
>		e.printStackTrace();
>        }
>    }
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


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


Mime
View raw message