AnsweredAssumed Answered

CMIS library

Question asked by puntino on Nov 4, 2009
Latest reply on Nov 4, 2009 by puntino
I've written a simple class in order to connect to Alfresco via CMIS interface, reported below.
import org.apache.chemistry.tck.atompub.TCKMessageWriter;
import org.apache.chemistry.tck.atompub.http.Connection;
import org.apache.chemistry.tck.atompub.utils.LogMessageWriter;

import org.apache.chemistry.tck.atompub.client.CMISClient;
import org.apache.chemistry.tck.atompub.http.ConnectionFactory;
import org.apache.chemistry.tck.atompub.http.httpclient.HttpClientConnectionFactory;
public class CMISApiTest extends CMISClient {
   private final static String serverURL = "http://localhost:8080/alfresco/api";
   public CMISApiTest(Connection connection, String serviceUrl,
         TCKMessageWriter messageWriter) {
      super(connection, serviceUrl, messageWriter);
      // TODO Auto-generated constructor stub
   }


   /**
    * @param args
    */
   public static void main(String[] args) {
      getConnection(serverURL, "admin","admin",true,true);
   }

   public static void getConnection(String serverUrl, String username, String password, boolean validate, boolean trace){
      ConnectionFactory connFactory = new HttpClientConnectionFactory(); 
      Connection conn = connFactory.createConnection(username, password);
      LogMessageWriter messageWriter = new LogMessageWriter();      
      CMISApiTest client = new CMISApiTest(conn, serverURL,messageWriter);
   try {
   
      //System.out.print(client.getWorkspace());
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }
At runtime I get the following exception:

log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpClient.getParams()Lorg/apache/commons/httpclient/params/HttpClientParams;
   at org.apache.chemistry.tck.atompub.http.httpclient.HttpClientConnection.<init>(HttpClientConnection.java:47)
   at org.apache.chemistry.tck.atompub.http.httpclient.HttpClientConnectionFactory.createConnection(HttpClientConnectionFactory.java:34)
   at connector.CMISApiTest.getConnection(CMISApiTest.java:38)
   at connector.CMISApiTest.main(CMISApiTest.java:32)

I've added the library common-httpclient-3.1.jar to my Java project. How can I sort this problem out ?

Outcomes