Sorry, previous message was incomplete.

We have a custom factory that derive from
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory.
We have it inside our war, we're plug it in inside application's context.xml
as

<Resource name="jdbc/db" auth="Container"
         type="javax.sql.DataSource"
         dsProps="properties.file"
         removeAbandoned="true"
         username="user"
         password="pass"
         driverClassName="com.mysql.jdbc.Driver"
         url="jdbc:mysql://url"
         factory="our.package.FactoryClass" />

So when we're trying to get jdbc/db by calling
DataSource dataSource   = ( DataSource )( new InitialContext () ).lookup(
"java:/comp/env/jdbc/db" );
our FactoryClass is actually called instead. So it is actually working via
JNDI.

On Fri, Sep 11, 2009 at 6:57 PM, Mark Thomas <ma...@apache.org> wrote:

> Kirill Vasiliev wrote:
> > Tomcat-5.5.27
> > Java 1.5.17
> > Win XP SP2
> >
> > In the documentation about custom resource factories (
> > http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html) I
> read
> > following: When you are through, place the factory class (and the
> > corresponding bean class) unpacked under $CATALINA_HOME/common/classes,
> or
> > in a JAR file inside $CATALINA_HOME/common/lib. In this way, the required
> > class files are visible to both Catalina internal resources and your web
> > application.
> > Does it mean that I must ALWAYS put it in common, or I must put it in
> common
> > if I want it visible to Tomcat?
> > I.e. can I put custom factory to WEB-INF/lib of my application if I don't
> > want it to be visible to Tomcat?
>
> You can, but if it isn't visible to Tomcat it isn't going to work via JNDI.
>
> Mark
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to