https://issues.apache.org/bugzilla/show_bug.cgi?id=47832

           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
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: kvasil...@gmail.com


In the documentation about custom resource factories
(http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html) 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"
         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" />

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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to