06-07-2016 08:45 AM
Hi,
I'm using the following code to retrieve customer (I have answered a customer with that first name) :
// Lookup Customers on Key/Value Pairs of PII Fields
Map<String, String> customerLookup = new TreeMap<String, String>(){{
put("Context_First_Name", "John");
}};
List<Customer> cusLookup = csClient.search(Customer.class, customerLookup, AND);
System.out.println("Customers associated with Lookup Criteria " + ':');
for(Customer cust : cusLookup ) {
// print the Customer Id(s) matching the Lookup criteria
System.out.println("Customer ID: " + cust.getId().toString());
}
I get that error :
2016-06-07 11:41:53 INFO KmsManager:322 - Successfully loaded the hashing salt from key https://encryption-a.wbx2.com/encryption/api/v1/keys/ac9a1fcb-e323-4249-91fe-d9b390784493
2016-06-07 11:41:53 INFO RESTClient:1133 - Error on GET: https://management.rciad.ciscoccservice.com/management/property/v1/user/propertyName/workgroup.lab.scr.encryption.latest.key.org.2ed8ba59-6479-4a14-89a6-8e8b226db46c
2016-06-07 11:41:53 INFO KmsManager:357 - Did not find a pre-existing kms key in the property table.
ApiError with errorType: notFound, errorData: propertyName, errorMessage: Object not found. Key: workgroup.lab.scr.encryption.latest.key.org.2ed8ba59-6479-4a14-89a6-8e8b226db46c
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.cisco.thunderhead.errors.ApiExceptionFactory.getApiException(ApiExceptionFactory.java:78)
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:113)
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:95)
at com.cisco.thunderhead.RESTClient.generateUriApiException(RESTClient.java:1019)
at com.cisco.thunderhead.RESTClient.handleErrors(RESTClient.java:994)
at com.cisco.thunderhead.RESTClient.get(RESTClient.java:334)
at com.cisco.thunderhead.RESTClient.get(RESTClient.java:224)
at com.cisco.thunderhead.RESTClient.get(RESTClient.java:211)
at com.cisco.thunderhead.kms.KmsManager.checkForLatestValidKey(KmsManager.java:345)
at com.cisco.thunderhead.kms.KmsManager.rotateKMSEncryptionKey(KmsManager.java:403)
at com.cisco.thunderhead.kms.KmsManager.tryInitialize(KmsManager.java:290)
at com.cisco.thunderhead.kms.KmsManager$InitializeCache.run(KmsManager.java:272)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Solved! Go to Solution.
06-07-2016 05:22 PM
Ok I found the problem,
it was because of the way I was adding the fieldsets to the customer object when I waqs adding custom fieldset
It's all working now.
thanks for your support.
Fred
06-07-2016 12:36 PM
Were you using the same connection data of workgroup "lab" for both creating and searching the customer whose Context_First_Name is "John" ?
And what is the version of context-service-sdk-extension.jar?
The errors ("Did not find a pre-existing kms key in the property table." and "Error on GET: http....") shown on your log are harmless log statements (CC SDK should not log the stack). When SDK could not find the pre-existing kms key, it will generate one. However, I do not see the log statement indicating if the new kms key is created or not. Could you post the whole logs of yours?
06-07-2016 02:59 PM
I have installed context-service-sdk-extension.jar 1.0.8 SDK and re-run the test. Now I have no error trace.
I'm using the same connetiondata for import and search.
I have done another test where I hardcode the customer I'm inserting into "customer" database and did a search right after it in the same function and same result, it didnt find the customer.
Is there a way to get "all" customer ... to see what is inserted into the database?
Is I change log4j log level to DEBUG, will it help?
thanks.
Fred
06-07-2016 05:22 PM
Ok I found the problem,
it was because of the way I was adding the fieldsets to the customer object when I waqs adding custom fieldset
It's all working now.
thanks for your support.
Fred
06-07-2016 06:22 PM
Can you share your broken and fixed code snippet? Will be good for others who may refer to this forum later.
Thanks
Vikram
06-08-2016 06:19 AM
Hi Vikram,
the problem was related to the way I have built my import file :
what doesnt work:
[
{
"fieldsets":[
"cisco.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"Context_First_Name",
"right":"John"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Last_Name",
"right":"Smith"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Home_Phone",
"right":"4187815309"
},
"type":"string"
}
],
"fieldsets":[
"IA.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"IA_NumeroPolice",
"right":"C1478566"
},
"type":"string"
}
],
"id":"76066410-1841-11e6-9d55-f38512983078"
},
{
"fieldsets":[
"cisco.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"Context_First_Name",
"right":"Jean-Philippe"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Last_Name",
"right":"Morand"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Home_Phone",
"right":"4184738796"
},
"type":"string"
}
],
"fieldsets":[
"IA.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"IA_NumeroPolice",
"right":"H58H45"
},
"type":"string"
}
],
"id":"76066410-1841-11e6-9d55-f38512983079"
}
]
what works :
[
{
"fieldsets":[
"cisco.base.customer",
"IA.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"Context_First_Name",
"right":"John"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Last_Name",
"right":"Smith"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Home_Phone",
"right":"4187815309"
},
"type":"string"
},
{
"keyValuePair":{
"left":"IA_NumeroPolice",
"right":"C1478566"
},
"type":"string"
}
],
"id":"76066410-1841-11e6-9d55-f38512983078"
},
{
"fieldsets":[
"cisco.base.customer",
"IA.base.customer"
],
"dataElements":[
{
"keyValuePair":{
"left":"Context_First_Name",
"right":"Jean-Philippe"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Last_Name",
"right":"Morand"
},
"type":"string"
},
{
"keyValuePair":{
"left":"Context_Home_Phone",
"right":"4184738796"
},
"type":"string"
},
{
"keyValuePair":{
"left":"IA_NumeroPolice",
"right":"H58H45"
},
"type":"string"
}
],
"id":"76066410-1841-11e6-9d55-f38512983079"
}
]
06-08-2016 06:29 AM
Thanks Fred. This seems like a doc gap, all examples have only 1 fieldset in it. I’ll get this fixed.
Vikram
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: