Index: src/main/java/org/apache/james/container/spring/JamesResourceLoader.java
===================================================================
--- src/main/java/org/apache/james/container/spring/JamesResourceLoader.java	(revision 944583)
+++ src/main/java/org/apache/james/container/spring/JamesResourceLoader.java	(working copy)
@@ -56,4 +56,13 @@
      * @return rootDir
      */
     public String getRootDirectory();
+
+    /**
+     * Return the directory where the external jar libraries must be placed by the
+     * adminstrator. The jars may contain mailets,...
+     * 
+     * @return externalLibraryDirectory
+     */
+    public String getExternalLibraryDirectory();
+    
 }
Index: src/main/java/org/apache/james/container/spring/JamesServerWebApplicationContext.java
===================================================================
--- src/main/java/org/apache/james/container/spring/JamesServerWebApplicationContext.java	(revision 944583)
+++ src/main/java/org/apache/james/container/spring/JamesServerWebApplicationContext.java	(working copy)
@@ -82,11 +82,20 @@
             }
         }
 
+		public String getExternalLibraryDirectory() {
+            if (externalLibDirectory == null) {
+                return getRootDirectory() + "/WEB-INF/lib/";
+            } else {
+                return externalLibDirectory;
+            }
+		}
+
     };
     private String rootDirectory;
     private String absoluteDirectory;
     private String varDirectory;
     private String confDirectory;
+    private String externalLibDirectory;
 
     /*
      * (non-Javadoc)
@@ -120,6 +129,11 @@
     public void setConfDirectory(String confDirectory) {
         this.confDirectory = confDirectory;
     }
+    
+    public void setExternalLibDirectory(String externalLibDirectory) {
+        this.externalLibDirectory = externalLibDirectory;
+    }
+
     /*
      * (non-Javadoc)
      * @see org.apache.james.container.spring.JamesResourceLoader#getAbsoluteDirectory()
@@ -151,4 +165,12 @@
     public String getRootDirectory() {
         return resourceLoader.getRootDirectory();
     }
+
+	/* (non-Javadoc)
+	 * @see org.apache.james.container.spring.JamesResourceLoader#getExternalLibraryDirectory()
+	 */
+	public String getExternalLibraryDirectory() {
+		return getRootDirectory() + "/WEB-INF/lib/";
+	}
+	
 }
Index: src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java
===================================================================
--- src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java	(revision 944583)
+++ src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java	(working copy)
@@ -18,6 +18,16 @@
  ****************************************************************/
 package org.apache.james.container.spring;
 
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.core.io.Resource;
@@ -27,6 +37,16 @@
  *
  */
 public class JamesServerApplicationContext extends ClassPathXmlApplicationContext implements JamesResourceLoader{
+	
+    /**
+     * The logger.
+     */
+    private final Log log = LogFactory.getLog(JamesServerApplicationContext.class);
+
+	/**
+	 * The ClassLoader that will be used by James application.
+	 */
+	private ClassLoader jamesClassLoader;
 
     /**
      * The resourceloader to use. This must be defined as static, otherwise it will fail to startup..
@@ -57,6 +77,13 @@
             return getRootDirectory() + "/var/";
         }
 
+        /* (non-Javadoc)
+         * @see org.apache.james.container.spring.JamesResourceLoader#getExternalLibraryDirectory()
+         */
+        public String getExternalLibraryDirectory() {
+            return getRootDirectory() + "/conf/lib";
+        }
+
         /*
          * (non-Javadoc)
          * @see org.apache.james.container.spring.JamesResourceLoader#getRootDirectory()
@@ -64,7 +91,7 @@
         public String getRootDirectory() {
             return "../";
         }
-
+        
     };
     
     
@@ -116,5 +143,39 @@
     public String getRootDirectory() {
         return resourceLoader.getRootDirectory();
     }
+    
+	/* (non-Javadoc)
+	 * @see org.apache.james.container.spring.JamesResourceLoader#getExternalLibraryDirectory()
+	 */
+	public String getExternalLibraryDirectory() {
+        return resourceLoader.getExternalLibraryDirectory();
+	}
+
+    /* (non-Javadoc)
+     * @see org.springframework.core.io.DefaultResourceLoader#getClassLoader()
+     */
+    public ClassLoader getClassLoader() {
+    	if (jamesClassLoader == null) {
+    		String[] jars = new File(resourceLoader.getExternalLibraryDirectory()).list(new FilenameFilter() {
+				public boolean accept(File dir, String name) {
+					return name.endsWith(".jar");
+				}
+			});
+    		List<URL> urls = new ArrayList<URL>();
+    		if (jars != null) {
+        		for (String jar: jars) {
+        			File file = new File(getExternalLibraryDirectory() + File.separator + jar);
+        			try {
+						urls.add(file.toURI().toURL());
+					} catch (MalformedURLException e) {
+						log.error("Got an unexpected exception while building the urls for the james class loader for file " + file.getAbsolutePath());
+					}
+        		}
+    		}
+    		jamesClassLoader = new URLClassLoader(urls.toArray(new URL[0]), Thread.currentThread().getContextClassLoader());
+    	}
+    	super.getClassLoader();
+    	return jamesClassLoader;
+    }
 
 }
