Error dependecy "org.codehaus.jackson"


Danny
 

Hi Jensen,

I have a problem when I want to use the "jackson" library in my ALTO project.

I am modifying the alto-Northbound project, I am adding a few code lines:

=======================================================
In pox file of alto-Northbound project I added:

<dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.7</version>          
    </dependency>

in imports add:

org.codehaus.jackson.jackson-core-asl.*
========================================================
In Java code (AltoNorthbound.java), I added:

import org.codehaus.jackson.JsonNode;
...
JsonNode rows = response.getEntity(JsonNode.class);
============================================================

The error is:
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonNode
    at org.opendaylight.alto.northbound.AltoNorthbound.REST_Query(AltoNorthbound.java:234)
    at org.opendaylight.alto.northbound.AltoNorthbound.retrieveNetworkMap(AltoNorthbound.java:166)

========================================================

Ss

Danny


Jensen Zhang
 

Hi Danny,

Projects in OpenDaylight use OSGi framework, and they need to be installed in karaf as features [1].

Because you introduce a new package into alto-northbound, you have to add new bundles or features in the 'odl-alto-northbound' feature. (It will be located in 'features/src/main/features/features.xml' or 'features/src/main/resources/features.xml'.)

But for your problem, I don't suggest you use org.codehaus.jackson in alto-northbound, unless necessary. Because:

1. You can use com.fasterxml.jackson.core [2], since this is a newer jackson implementation than org.codehaus.jackson. And we have imported bundles for this into alto-commons which is an dependency of alto-northbound, so you can just repleace the dependency declaration in alto-northbound by this new one.
2. But you'd better not use jackson in northbound module. It is just a front-end and it should not implement any complex logic. You can implement your functions in alto-services or alto-provider. For example, the implementation of 'getNetworkMap' is in 'alto-services/provider/simple-alto/src/main/java/org/opendaylight/alto/services/provider/simple/SimpleAltoService.java'.

Hope this is helpful to you.

---

Hi Jensen,

I have a problem when I want to use the "jackson" library in my ALTO project.

I am modifying the alto-Northbound project, I am adding a few code lines:

=======================================================
In pox file of alto-Northbound project I added:

<dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.7</version>          
    </dependency>

in imports add:

org.codehaus.jackson.jackson-core-asl.*
========================================================
In Java code (AltoNorthbound.java), I added:

import org.codehaus.jackson.JsonNode;
...
JsonNode rows = response.getEntity(JsonNode.class);
============================================================

The error is:
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonNode
    at org.opendaylight.alto.northbound.AltoNorthbound.REST_Query(AltoNorthbound.java:234)
    at org.opendaylight.alto.northbound.AltoNorthbound.retrieveNetworkMap(AltoNorthbound.java:166)

========================================================

Ss

Danny


Danny
 

Hi Jensen

It was very helpful your reply.

1. I am using now com.fasterxml.jackson.core

2. At present I am modifying the Northbound module, because I am doing some tests recovering ALTO information of my Neo4j graph database (Not from MD-SAL data store), so I need only the input parameters (for example "id" in the retrieveNetworkMap function), after I create a RFC7285NetworkMap variable and to assigns its properties (for example "meta" and "map") from my ALTO information (recovered from a query to Neo4j) and return the request.

Thanks again

Ss

Danny

On Thu, Aug 27, 2015 at 10:45 PM, Jensen Zhang <jingxuan.n.zhang@...> wrote:
Hi Danny,

Projects in OpenDaylight use OSGi framework, and they need to be installed in karaf as features [1].

Because you introduce a new package into alto-northbound, you have to add new bundles or features in the 'odl-alto-northbound' feature. (It will be located in 'features/src/main/features/features.xml' or 'features/src/main/resources/features.xml'.)

But for your problem, I don't suggest you use org.codehaus.jackson in alto-northbound, unless necessary. Because:

1. You can use com.fasterxml.jackson.core [2], since this is a newer jackson implementation than org.codehaus.jackson. And we have imported bundles for this into alto-commons which is an dependency of alto-northbound, so you can just repleace the dependency declaration in alto-northbound by this new one.
2. But you'd better not use jackson in northbound module. It is just a front-end and it should not implement any complex logic. You can implement your functions in alto-services or alto-provider. For example, the implementation of 'getNetworkMap' is in 'alto-services/provider/simple-alto/src/main/java/org/opendaylight/alto/services/provider/simple/SimpleAltoService.java'.

Hope this is helpful to you.

---
Thanks,
Jensen

2015-08-28 4:44 GMT+08:00 Danny Alex Lachos Perez <dlachosper@...>:
Hi Jensen,

I have a problem when I want to use the "jackson" library in my ALTO project.

I am modifying the alto-Northbound project, I am adding a few code lines:

=======================================================
In pox file of alto-Northbound project I added:

<dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.7</version>          
    </dependency>

in imports add:

org.codehaus.jackson.jackson-core-asl.*
========================================================
In Java code (AltoNorthbound.java), I added:

import org.codehaus.jackson.JsonNode;
...
JsonNode rows = response.getEntity(JsonNode.class);
============================================================

The error is:
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonNode
    at org.opendaylight.alto.northbound.AltoNorthbound.REST_Query(AltoNorthbound.java:234)
    at org.opendaylight.alto.northbound.AltoNorthbound.retrieveNetworkMap(AltoNorthbound.java:166)

========================================================

Ss

Danny