0
votes

I would like to place a Java array in a scope variable. Here is how the array is build

Person[] persons = null;
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(url);
String json = service.accept(MediaType.APPLICATION_JSON).get(String.class);
ObjectMapper mapper = new ObjectMapper();
persons = mapper.readValue(json, Person[].class);
return persons

I use the Jackson library to parse JSON into Java objects ref: http://jackson.codehaus.org/1.0.1/javadoc/org/codehaus/jackson/map/ObjectMapper.html

I can bind the persons array directly to a repeat control.

However if I attempt to store the array first in a scope variable I get a 500 error message.

var persons = personsBeanTest.getPersons("http://dev1/fakenames.nsf/api/data/collections/name/people?count=10");
viewScope.put("names",persons);

HTTP JVM: CLFAD0211E: Exception thrown. For more detailed information, please consult error-log-0.xml located in C:/Program Files/IBM/Domino/data/domino/workspace/logs HTTP JVM: CLFAD0229E: Security exception occurred servicing request for: /fakenames.nsf/index_1.xsp - HTTP Code: 500. For more detailed information, please consult error-log-0.xml located in C:/Program Files/IBM/Domino/data/domino/workspace/logs

Can someone explain what I am doing wrong and how I should correct the code to place the array into a scope variable?

2
Did you do as the message sais and consulted the log file? The exception also contains Security exception occurred so I'd look in that direction.Thomas
things solve when u include serializable ...Patrick Kwinten

2 Answers

2
votes

Good point from Thomas in the comment: when using an external lib like Jackson you have to set permissions for it in the Java security policy settings. How to do that is explained here http://oliverbusse.notesx.net/hp.nsf/blogpost.xsp?documentId=EAA or here http://www.dalsgaard-data.eu/blog/java-security-in-ibm-domino/

2
votes

I had to include serializable for my objects :-/