This is my first question, but I have been looking for a solution for 2 days, with no success.
In my project, I have a User
entity with a transient property:
@Transient
@JsonProperty
private List<String> files;
I have no setter, and getter is:
public List<String> getFiles() {
/* Call one static method */
}
Executing the application with NetBeans in debug, works fine, and from javascript, I can get the getFiles results, using user.fotos
. But when I generate .jar file, and I execute the application with command java -jar app.jar
, by calling one Rest function that must return one User
object, I get this exception:
2015-10-28 14:39:35.963 WARN 27836 --- [nio-7777-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: (was java.lang.NullPointerException) (through reference chain: com.pfc.soriano.wsdbmodel.entity.User["files"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.pfc.soriano.wsdbmodel.entity.User["files"])
2015-10-28 14:39:35.963 WARN 27836 --- [nio-7777-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Handler execution resulted in exception: Could not write content: (was java.lang.NullPointerException) (through reference chain: com.pfc.soriano.wsdbmodel.entity.User["files"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.pfc.soriano.wsdbmodel.entity.User["files"])
My question is: What is Netbeans doing different from command line java -jar, which makes it work fine?