Antoine Levy-Lambert schrieb am 19.01.2011 um 18:51 (-0500):
> Adding for clarity that the reason why the classloader task helps in
> this case is that mail.jar and activation.jar contain factory classes
> which cannot be loaded from the loader of the mail task directly if
> mail.jar and activation.jar were not in $ANT_HOME/lib or another
> directory picked up at startup.
> 
> In a similar fashion, if you are using the <sql/> task, you have to
> either put your JDBC driver in the directories from which ant loads all
> the jars at startup or add the JDBC driver using the classloader task.

This reminds me of Tomcat classloader issues. You also have to make the
JDBC drivers available to the common.loader, which loads classes that
should be accessible to both the server and the web applications.

  The common classloader is responsible for loading classes common to
  the tomcat installation. Which are in the Tomcat 6 the server classes
  as well as addiontional classes like the JavaMail API oder some
  database driver classes (if you are configuring them with JNDI i.e.).
  -- http://nicl.net/2008/07/tomcat-6x-doing-it-the-right-way/

I've got one more quote and a question.

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html

          \,,,/
          (o o)
------oOOo-(_)-oOOo--------------
4. Install the JavaMail libraries

Download the JavaMail API. The JavaMail API requires the Java Activation
Framework (JAF) API as well. The Java Activation Framework is included
in Java SE 6 onwards. Java SE 5 users can download the latest version,
JAF 1.1.1.

Unpackage the distribution(s) and place mail.jar (and activation.jar if
required) into $CATALINA_HOME/lib so the JAR(s) is(are) available to
Tomcat during the initialization of the mail Session Resource. Note:
placing jars in both $CATALINA_HOME/lib and a web application's lib
folder will cause an error, so ensure mail.jar (and activation.jar)
is(are) placed only the $CATALINA_HOME/lib location.
----------------------------------------------------

What is special about JavaMail, JAF (Activation) and JDBC drivers that
they cannot be loaded by any other classloader?

-- 
Michael Ludwig

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

Reply via email to