Hi,

Sorry but my preceding analysis was false : I have a problem but NOT with the 
delegate.
So, I reexplain the case :

1- I have 
$CATALINA_HOME/common/lib/mysql-connector-java-2.0.14-bin.jar
$CATALINA_HOME/common/lib/naming-factory-dbcp.jar
2- I have a war with
WEB-INF/lib/mysql-connector-java-3.0.15-ga-bin.jar
WEB-INF/lib/naming-factory-dbcp.jar

in my test, I do :
Class driver = Class.forName("org.gjt.mm.mysql.Driver");
URL ressource = 
driver.getClassLoader().getResource("org/gjt/mm/mysql/Driver.class");
out.println( "ClassForname==>"+ressource );

If, in my Context element, I put a Loader with delegate=false (the default), it 
prints : 
ClassForname==>jar:file:/usr/local/tomcat/webapps/myContext/WEB-INF/lib/mysql-connector-java-3.0.15-ga-bin.jar!/org/gjt/mm/mysql/Driver.class

If I put delegate=true, it prints :
ClassForname==>jar:file:/usr/local/tomcat/common/lib/mysql-connector-java-2.0.14-bin.jar!/org/gjt/mm/mysql/Driver.class

So delegate works as it is expected.

My problem is that, in my first test, I did :
Context ctx = new InitialContext();
DataSource dataSource = (DataSource)ctx.lookup("java:/comp/env/jdbc/myDB");
URL ressource = 
dataSource.getClass().getClassLoader().getResource("org/gjt/mm/mysql/Driver.class");
out.println( "JndiForname==>"+ressource );

and, in this case, I always have :
ClassForname==>jar:file:/usr/local/tomcat/common/lib/mysql-connector-java-2.0.14-bin.jar!/org/gjt/mm/mysql/Driver.class

So, for now, I don't find the solution to use the Driver inside the war :-(
But this is another problem...

Sorry Remy for the bad bug report.

On Wed, 23 Mar 2005 17:26:34 +0100
Lionel Farbos <[EMAIL PROTECTED]> wrote:

> Hi Simon,
> 
> I wanted to use this flag because, in my $CATALINA_HOME/common/lib,
> I have mysql-connector-java-2.0.14-bin.jar
> but, 
> in some wars, I have 
> WEB-INF/lib/mysql-connector-java-3.0.15-ga-bin.jar
> WEB-INF/lib/naming-factory-dbcp.jar
> and in other wars, I don't have any Driver Mysql
> 
> So, I'd want the war_WEB-INF/lib/<Mysql_jar> to be taken BEFORE the 
> common/lib/<Mysql_jar> one when it is possible
> and
> the common/lib/<Mysql_jar> to be taken in other cases.
> 
> So I tried to put 
> <Loader className="org.apache.catalina.loader.WebappLoader" delegate="false" 
> />
> or 
> <Loader className="org.apache.catalina.loader.WebappLoader" delegate="true" />
> in my Context.xml
> But it is always the common/lib/jar one which is taken :-((
> 
> I don't know if it is a bug or a bad config from me ....
> 
> If a Tomcat Developer can say to me what I am wrong ...
> 
> Note : To confirm the Driver version, I print :
> dataSource.getClass().getClassLoader().getResource("org/gjt/mm/mysql/Driver.class");
> 
> Cheers
> On Sat, 19 Mar 2005 17:44:40 +1300
> Simon Kitching <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > I see here that there is an option for the webapp-specific classloader
> > to use parent-first classloading instead of the (default) child-first
> > classloading.
> > 
> > Can someone suggest why this might be useful? Clearly someone thought
> > so, but I can't see any point in it. It is in catalina since version 1.1
> > (committer: Remy Maucherat).
> > 
> > See "delegate" option in this page:
> >   http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/loader.html
> > 
> > Using this option makes life exceedingly complicated for some libs like
> > commons-beanutils and commons-logging, so I would like to know under
> > what conditions someone might enable this feature.
> > 
> > Regards,
> > 
> > Simon
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to