获取
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
Unrecognized field "operationMessage" (class worker.lib.message.OperationMessage), not marked as ignorable (9 known properties: "packageMessage", "sourceAsset", "operation", "publishMessage", "requestId", "remixMessage", "targetAsset", "jobId", "intermediates"])
at [Source: (String)"{"operationMessage":{"sourceAsset":{"path":"/a/b/c.txt","repoId":"testId","region":"va6"},"targetAsset":{"path":"/folder4","repoId":"id2","region":"va6"},"jobId":"7c540211d1054442940211d10594426e","intermediates":false}}"; line: 1, column: 22] (through reference chain:
worker.lib.message.OperationMessage["operationMessage"])
我的OperationMessage类是
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data //generates getter and setters
public class OperationMessage {
@JsonProperty(value = "jobId")
private String jobId;
@JsonProperty(value = "operation")
private Operation operation;
@JsonProperty(value = "intermediates")
private Boolean intermediates; //for copy-move
private AssetProperties sourceAsset;
private AssetProperties targetAsset;
private PublishMessage publishMessage; //fields related to publish Operation.
private RemixMessage remixMessage; //fields related to remix Operation.
private PackageMessage packageMessage;//fields related to package Operation
private String requestId;
@Override
public String toString() {
return "OperationMessage [jobId=" + jobId + ", operation=" + operation + "]";
}
}
有人可以建议这里有什么问题吗?
答案 0 :(得分:1)
您应该做的一些事情如下:
1)为类的成员变量添加getter和setters
2)添加默认构造函数import pyodbc
import pandas as pd
#Database Connection
conn = pyodbc.connect(driver='xxxxxx', server='xxxxxxx', database='xxxxxx',
user='xxxxxx', password='xxxxxxxx')
cursor = conn.cursor()
depts = ['Human Resources','Accounting','Marketing']
# gives you the string to use in your sql query:
depts_query_string = "('{query_vals}')".format(query_vals="','".join(depts))
query = """
SELECT *
FROM device ID
WHERE
Department in {query_vals}
AND
Status like 'Active'
""".format(query_vals=depts_query_string)
target = r'O:\\Example'
today = target + os.sep + time.strftime('%Y%m%d')
if not os.path.exists(today):
os.mkdir(today)
for i in departments:
#workbook = Workbook(today + os.sep + i + 'xlsx')
#worksheet = workbook.add_worksheet()
P_data = pd.read_sql(query, conn)
P_data.to_excel(today + os.sep + i + 'xlsx')
3)实施public class OperationMessage { }
Serializable
4)将public class OperationMessage implements Serializable
注释添加到您的POJO
答案 1 :(得分:0)
您没有getter和setter ...或将这些字段更改为公开字段。