AnsweredAssumed Answered

CMIS Client JAVA - Alfresco

Question asked by pat9rv3sousa on Sep 23, 2015
Latest reply on Sep 25, 2015 by pat9rv3sousa
I'm starting with Alfresco. I'm following a tutorial book Alfresco CMIS, and, to make a CMIS Client JAVA I start by using the Maven Quick Start artifact: mvn archetype:generate -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false and this create a project with a directory structure and a java file to put this code:


public class App
    public static void main( String[] args )
        CmisClient cmisClient = new CmisClient();
        String connectionName = "testeConn";
        Session session = cmisClient.getSession(connectionName, "admin", "admin");

And configure the pom.xml with that:

<project xmlns="" xmlns:xsi=""
  <!– Bring in the OpenCMIS library for talking to CMIS
servers –>

And in the same package of the App class, we create the file with this:

public class CmisClient {
    private static Log logger = LogFactory.getLog(CmisClient.class);
    private static Map<String, Session> connections = new
    ConcurrentHashMap<String, Session>();
    public CmisClient() {
    public Session getSession(
        String connectionName, String username, String pwd) {
        Session session = connections.get(connectionName);
        if (session == null) {
  "Not connected, creating new connection to" +
                " Alfresco with the connection id (" + connectionName +
// No connection to Alfresco available, create a new one
            SessionFactory sessionFactory =
            Map<String, String> parameters = new HashMap<String,
            parameters.put(SessionParameter.USER, username);
            parameters.put(SessionParameter.PASSWORD, pwd);
            parameters.put(SessionParameter.COMPRESSION, "true");
            parameters.put(SessionParameter.CACHE_TTL_OBJECTS, "0");
// If there is only one repository exposed (e.g. Alfresco),
// these lines will help detect it and its ID
            List<Repository> repositories =
            Repository alfrescoRepository = null;
            if (repositories != null && repositories.size() > 0) {
      "Found (" + repositories.size() +
                    ") Alfresco repositories");
                alfrescoRepository = repositories.get(0);
      "Info about the first Alfresco repo [ID=" +
                    alfrescoRepository.getId() + "][name=" +
                    alfrescoRepository.getName() + "][CMIS ver supported=" +
                    alfrescoRepository.getCmisVersionSupported() + "]");
            } else {
                throw new CmisConnectionException(
                    "Could not connect to the Alfresco Server, " +
                    "no repository found!");
// Create a new session with the Alfresco repository
            session = alfrescoRepository.createSession();
// Save connection for reuse
            connections.put(connectionName, session);
        } else {
  "Already connected to Alfresco with the " +
                "connection id (" + connectionName + ")");
        return session;

I'm trying to run the command mvn compile exec:java -Dexec.mainClass="" to run the code, indicated by the book. But, i got the error:

I put on the pastebin because I think that with all debug it's more easy for understand. What is my error?

I already try to import org.apache.chemistry.opencmis.client.api in the java file, but without success… I think maven do this, but anything is wrong.