tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47832] New: Custom resource factory placement
Date Mon, 14 Sep 2009 08:48:18 GMT

           Summary: Custom resource factory placement
           Product: Tomcat 6
           Version: 6.0.20
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina

In the documentation about custom resource factories
( I read
following: You will need to compile this class against a class path that
includes all of the JAR files in the $CATALINA_HOME/lib directory. When you are
through, place the factory class (and the corresponding bean class) unpacked
under $CATALINA_HOME/lib, or in a JAR file inside $CATALINA_HOME/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 to be visible to Tomcat? Can I put custom factory to WEB-INF/lib of
my application if I don't want it to be visible to Tomcat?

Actually 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"
         factory="our.package.FactoryClass" />

Factory just searching for properties.file and if it is found, it's props will
be used to create datasource, otherwise props from context.xml will be used.
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 works this way, but I
still don't understand is it proper way or not.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message