java - Pivotal Web Services Spring Error -


when upload spring application pivotal web services, 2 errors:

err caused by: org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.http.converter.json.mappingjackson2httpmessageconverter]: factory  method 'jacksonhttpmessageconverter' threw exception; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name  'objectmapper' defined in class path resource [io/app/config/apprestmvcconfiguration.class]: bean instantiation via factory method  failed; nested exception org.springframework.beans.beaninstantiationexception: failed  instantiate [com.fasterxml.jackson.databind.objectmapper]: factory method 'objectmapper'  threw exception; nested exception java.lang.nullpointerexception 

and

failed instantiate [org.springframework.http.converter.json.mappingjackson2httpmessageco nverter]: factory method 'haljacksonhttpmessageconverter' threw exception; nested  exception org.springframework.beans.factory.beancreationexception: error creating bean  name 'halobjectmapper' defined in class path resource [io/papped/config/pappedrestmvcc onfiguration.class]: bean instantiation via factory method failed; nested exception  org.springframework.beans.beaninstantiationexception: failed instantiate  [com.fasterxml.jackson.databind.objectmapper]: factory method 'halobjectmapper' threw  exception; nested exception java.lang.nullpointerexception 

so basically, can't initialise objectmapper , halobjectmapper in configuration class (these predefined in springbootrepositoryrestmvcconfiguration class). these errors not occur when run app locally on computer.

i have tried removing config class still gives error. have tried manually instantiating objectmapper/halobjectmapper using following code:

private final static objectmapper mapper = new objectmapper();  @bean @primary public com.fasterxml.jackson.databind.objectmapper objectmapper() {     return mapper; }  @bean @primary public objectmapper halobjectmapper() {     return mapper; } 

this makes run on pivotal web services, gives stack overflow error time try access mongorepository (there no circular references in models).

how can solved?

the problem way setting mongo repository service cloud. using following code made work:

@configuration @profile("!local") public class databaseconfiguration extends abstractcloudconfig {     @bean     public mongodbfactory documentmongodbfactory() {         return connectionfactory().mongodbfactory();     } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -