2

I am trying this new program that gets the document from Alfresco. Mine is Alfresco version 4.2 and latest openCMIS. Below is my code.

public class Test {

/**
 * @param args
 */
public static void main(String[] args) {

    SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
    Map<String, String> parameter = new HashMap<String, String>();

    Session session = null;
    OperationContext operationContext = new OperationContextImpl();
    operationContext.setCacheEnabled(true);


    parameter.put(SessionParameter.USER, "admin");
    parameter.put(SessionParameter.PASSWORD, "admin");
    parameter.put(SessionParameter.ATOMPUB_URL, "http://alfresco-url.com/alfresco/api/-default-/public/cmis/versions/1.0/atom");

    parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, "us");
    parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "en");
    parameter.put(SessionParameter.LOCALE_VARIANT, "");


    Repository soleRepository = (Repository)sessionFactory.getRepositories(parameter).get(0);
    session = soleRepository.createSession();

    session.setDefaultContext(operationContext);

    String cmisObjectId = "workspace://SpacesStore/u456ce2c-5675-3f66-fgh5-d45g567w35";

    CmisObject obj = session.getObject(new ObjectIdImpl(cmisObjectId));

}

}

I am getting the below exception at the last line.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.NoClassDefFoundError: com/ctc/wstx/stax/WstxInputFactory at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:98) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:620) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:809) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:65) at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:90) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:135) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:112) at com.test.Test.main(Test.java:55) Caused by: java.lang.ClassNotFoundException: com.ctc.wstx.stax.WstxInputFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 8 more

Can anyone help me to find which JAR I need to add?

Sree
  • 921
  • 2
  • 12
  • 31

2 Answers2

3

You can find it here: Maven Central

As suggested by Marged, it would be much easier using maven.

John Henry
  • 301
  • 3
  • 9
0

I would suggest you to go fetch the jar from here and add it your classpath.

Younes Regaieg
  • 4,156
  • 2
  • 21
  • 37