javax.jcr.ValueFormatException: Can not assign multiple values to single valued property - property set dynamically via sling servlet
Hi all,
i am trying to populate a node (nt:unstructured) with properties and values taken from a json file.
i am getting issues in populating arraylist of strings to the jcr node. The below error is being reported
javax.jcr.ValueFormatException: Can not assign multiple values to single valued property:The property set on last line of the below code creates single-valued property and not multi-valued as i want.
Resource resource = request.getResourceResolver().getResource(aemPath);
Node node = resource.adaptTo(Node.class);
Value[] values = new Value[ArrayList.size()];
node = resource.adaptTo(Node.class);
Value[] values = new Value[ArrayList.size()];
ValueFactory valueFactory = node.getSession().getValueFactory();
for(int index=0; index<ArrayList.size(); index++){
values[index] = valueFactory.createValue(ArrayList.get(index));
}
node.setProperty(aemFieldName, values);@aanchal-sikka, @jennifer_dungan, @yuhuisg, @estebanbustamante, @harwinder-singh, @arunpatidar, @rohan_garg