From d53780168e3a0384b340d0ebdfc978a9a76c66af Mon Sep 17 00:00:00 2001 From: Sam Hague Date: Sun, 1 Mar 2015 21:40:21 -0500 Subject: [PATCH] Bug 2438: No serializer found for class.. BooleanBaseType When using the OVSDB Northbound v3 APIs the below error is returned when GET'ting tables that contain boolean columns. http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v3/node/OVS|192.168.120.31:48161/database/Open_vSwitch/table/Bridge No serializer found for class org.opendaylight.ovsdb.lib.schema.BaseType$BooleanBaseType and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.opendaylight.ovsdb.lib.schema.GenericTableSchema["columnSchemas"]->java.util.HashMap["stp_enable"]->org.opendaylight.ovsdb.lib.schema.ColumnSchema["type"]->org.opendaylight.ovsdb.lib.schema.AtomicColumnType["baseType"]) The boolean type does not have a public getter/setter since it doesn't need one but this error comes from that. Configure the object mapper to safely ignore the error. Change-Id: I1fc0cca6b48a698f711dc61b4a33763ff2fa521d Signed-off-by: Sam Hague --- .../org/opendaylight/ovsdb/northbound/DatabaseResource.java | 5 ++--- .../java/org/opendaylight/ovsdb/northbound/NodeResource.java | 2 ++ .../java/org/opendaylight/ovsdb/northbound/RowResource.java | 3 ++- .../org/opendaylight/ovsdb/northbound/TableResource.java | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/DatabaseResource.java b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/DatabaseResource.java index 70bde89d7..9552984c1 100644 --- a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/DatabaseResource.java +++ b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/DatabaseResource.java @@ -1,5 +1,6 @@ package org.opendaylight.ovsdb.northbound; +import com.fasterxml.jackson.databind.SerializationFeature; import java.util.List; import javax.ws.rs.GET; @@ -10,11 +11,8 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException; -import org.opendaylight.controller.sal.core.Node; -import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.ovsdb.lib.OvsdbClient; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; -import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -31,6 +29,7 @@ public class DatabaseResource { this.nodeId = id; objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } private DatabaseSchema getDatabaseSchema (String databaseName) { diff --git a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/NodeResource.java b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/NodeResource.java index e3ed0d2fb..3cdf0f126 100644 --- a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/NodeResource.java +++ b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/NodeResource.java @@ -1,5 +1,6 @@ package org.opendaylight.ovsdb.northbound; +import com.fasterxml.jackson.databind.SerializationFeature; import java.io.InputStream; import java.util.List; @@ -36,6 +37,7 @@ public class NodeResource { public NodeResource () { objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } public static Node getOvsdbNode(String nodeId, Object bundleClassRef) { diff --git a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/RowResource.java b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/RowResource.java index b1f3435fd..038a0b597 100644 --- a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/RowResource.java +++ b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/RowResource.java @@ -1,5 +1,6 @@ package org.opendaylight.ovsdb.northbound; +import com.fasterxml.jackson.databind.SerializationFeature; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -50,7 +51,7 @@ public class RowResource { this.tableName = tableName; objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } private OvsdbRow getOvsdbRow (InputStream stream) throws IOException { diff --git a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/TableResource.java b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/TableResource.java index 61bf7f995..46ae46ad7 100644 --- a/northbound/src/main/java/org/opendaylight/ovsdb/northbound/TableResource.java +++ b/northbound/src/main/java/org/opendaylight/ovsdb/northbound/TableResource.java @@ -1,5 +1,6 @@ package org.opendaylight.ovsdb.northbound; +import com.fasterxml.jackson.databind.SerializationFeature; import java.util.Set; import javax.ws.rs.GET; @@ -31,7 +32,7 @@ public class TableResource { this.databaseName = databaseName; objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } private DatabaseSchema getDatabaseSchema (String databaseName) { -- 2.36.6