Hello, I am using Slide's WebDAV library to connect to Microsoft Exchange Server 2000. First of all, as a side note for those trying it be sure to upgrade to service pack 1 of Exchange so that valid XML is generated in response to a PROPFIND for all properties. Otherwise you won't be able to parse the XML response to this query. Nextly, there is an issue with thread-safety that appers to be in the Slide WebDAV client library and is simple to reproduce. At the bottom of this email is source code written to Slide 1.0.11 that causes the error. It simply creates N number of threads to do a PROPFIND for all properties. (This exerciser really doesn't need to connect to Exchange 2K- any WebDAV server should be fine.) An example command line to run it with five threads is as follows: java ExchangeWebdavTest http://server/exchange/Mailbox/Inbox 5 Occasionally all five threads will succeed, but much of the time output will be like: ----- Making DAV Connection... Making DAV Connection... Making DAV Connection... Making DAV Connection... Making DAV Connection... connect time = 3475 connect time = 4317 java.lang.NullPointerException at org.apache.commons.httpclient.HttpMethodBase.generateRequestLine(HttpMethodB ase.java:519) at org.apache.commons.httpclient.HttpClient.sendRequestHeader(HttpClient.java:8 35) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:422) at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:2388 ) at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:2359 ) at ExchangeWebdavTest$ExchangeWebdavThread.run(ExchangeWebdavTest.java:110) at java.lang.Thread.run(Unknown Source) ----- Looking at the source code for HttpMethodBase, it seems like the "state" member variable is ending up null. It's almost as if these objects are getting recycled before we finish using them. I would like to find and fix this problem myself but it's unclear what revision of commons should be pulled down to work with Slide 1.0.11 (there are no obvious tags in the commons tree). Does anyone know what the issue could be? Or know how I can get a buildable snapshot of the commons tree used as of the 1.0.11 Slide release? tx, Pete ----- /** * * Exchange 2K WebDAV test program. First argument is the URL to connect to * and second is the number of threads to create. * * @author PHeist (07/01) */ public class ExchangeWebdavTest { /** * Method description. * * @author PHeist (07/01) */ public ExchangeWebdavTest ( ) { } /** * Main. * * @author PHeist (07/01) */ public static void main ( String[] args ) { for (int i = 0; i < Integer.parseInt (args[1]); i++) { ExchangeWebdavTest test = new ExchangeWebdavTest(); Thread thr = new Thread (test.new ExchangeWebdavThread (new String (args[0]))); thr.start (); } } /** * * Exchange WebDAV thread. * * @author PHeist (07/01) */ public class ExchangeWebdavThread implements Runnable { private String i_sUrl; /** * Constructor. * * @author PHeist (07/01) */ public ExchangeWebdavThread ( String sUrl ) { i_sUrl = sUrl; } /** * Method description. * * @author PHeist (07/101) */ public void run ( ) { WebdavResource resource = null; try { System.out.println ("Making DAV Connection..."); HttpURL url = new HttpURL (i_sUrl); url.setUserInfo ("CLUSTER\\PHeist", "pheist"); long lStart = System.currentTimeMillis (); resource = new WebdavResource (url); Enumeration props = resource.propfindMethod(Integer.MAX_VALUE); int i = 0; while (props.hasMoreElements()) { ResponseEntity entity = (ResponseEntity) props.nextElement(); //System.out.println ((i++) + " (" + entity.getClass() + "): " + entity); //System.out.println (i++); Enumeration responseProperties = entity.getProperties(); while (responseProperties.hasMoreElements()) { Property responseProp = (Property) responseProperties.nextElement(); //System.out.println (" " + responseProp.getName() + "| " + // responseProp.getPropertyAsString()); } } System.out.println ("connect time = " + (System.currentTimeMillis() - lStart)); } catch (Exception e) { e.printStackTrace (); } finally { if (null != resource) try { resource.close (); } catch (IOException ioe) { } } } } // ExchangeWebdavThread } // ExchangeWebdavTest
