Problem with nuxeo java automation client 6.0

Hello I'm newbie in the nuxeo world and I was trying to follow the examples in http://doc.nuxeo.com/display/NXDOC/Java+Automation+Client . I've deployed the nuxeo 6.0 platform and created a test to try to connect to the automation platform, adding the dependency in the project's pom file:

<dependency>
        <groupId>org.nuxeo.ecm.automation</groupId>
        <artifactId>nuxeo-automation-client</artifactId>
        <scope>compile</scope>
        <version>6.0</version>
</dependency>

When I run the test, at the moment to adquire a Session, the program fails with a NoSuchMethodError:

@Test
public void conexion() throws Exception {
    HttpAutomationClient client = new HttpAutomationClient(
            "http://localhost:8080/nuxeo/site/automation");
    Session session = client.getSession("username", "password");
    client.shutdown();
}

The exception is thrown at Session session = client.getSession();

java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: org.codehaus.jackson.map.ObjectMapper.getTypeFactory()Lorg/codehaus/jackson/map/type/TypeFactory;
at org.nuxeo.ecm.automation.client.jaxrs.spi.JsonMarshalling.newJsonFactory(JsonMarshalling.java:125)
at org.nuxeo.ecm.automation.client.jaxrs.spi.JsonMarshalling.<clinit>(JsonMarshalling.java:112)
at org.nuxeo.ecm.automation.client.jaxrs.spi.Request.handleResult(Request.java:118)
at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:158)
at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:120)
at org.nuxeo.ecm.automation.client.jaxrs.spi.ConnectorHandler.execute(ConnectorHandler.java:30)
at org.nuxeo.ecm.automation.client.jaxrs.spi.AbstractAutomationClient.connect(AbstractAutomationClient.java:103)
at org.nuxeo.ecm.automation.client.jaxrs.spi.AbstractAutomationClient.getSession(AbstractAutomationClient.java:128)

The jackson dependencies for the automation client seems to be right, version 1.8.1 for jackson-core-asl and jackson-mapper-asl ( and both jars are the same that are included with the Nuxeo Platform).

If a try to GET the url from the browser, I get a JSON describing the automation chains availables (or at least I think so), so the server looks to be working correctly.

Has anyone fall in the same error?

Thanks in advance. Gonzalo Ferreyra

0 votes

1 answers

1696 views

ANSWER



I'm sorry guys, but it was a class loading problem; In my pom.xml file, there was declared glassfish-embedded-all as a test dependency, which seems to be loading another version of the jackson libs. I revert the order in the pom (first the nuxeo-automation-client dependency, and after that the glassfish-embedded-all dependency) and the problem was gone. I'm connecting with the server without any problems. Thanks, Gonzalo.

0 votes