Rohit Bajaj
asked on
Getting Conflicting setter definitions for property error in spring
HI,
I am getting the following error while running my spring web app :
The post request that i am making has the following json :
"{"title":"Title","body":" <p>slkdjls kdjflkasdj f</p>","me ssage":"co mment","pr eview":"<p >slkdjlskd jflkasdjf< br></p>"," previewHei ght":23,"m arkdown":n ull,"isMar kdown":fal se}"
Here is the handler function for this post request :
@RequestMapping(value = "/notes", method = RequestMethod.POST, consumes = "application/json")
public void createNote(@RequestBody Note note, HttpServletResponse response, HttpServletRequest request) throws IOException {
The issue is in Note class. Currently the class is :
The two setter with same name is probably causing the conflict . How do i resolve this ?
Thanks
I am getting the following error while running my spring web app :
2016-08-07 17:24:11 INFO main / Initializing Spring root WebApplicationContext
2016-08-07 17:24:11 INFO main org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization started
2016-08-07 17:24:11 INFO main org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization started
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi supportDeepBinding=false
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@37574691
2016-08-07 17:24:11 INFO main org.springframework.web.context.support.XmlWebApplicationContext Refreshing Root WebApplicationContext: startup date [Sun Aug 07 17:24:11 IST 2016]; root of context hierarchy
2016-08-07 17:24:11 INFO main org.springframework.web.context.support.XmlWebApplicationContext Refreshing Root WebApplicationContext: startup date [Sun Aug 07 17:24:11 IST 2016]; root of context hierarchy
2016-08-07 17:24:11 INFO main org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [spring/root-context.xml]
2016-08-07 17:24:11 INFO main org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [spring/root-context.xml]
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@5dda768f
2016-08-07 17:24:11 DEBUG main jndi supportDeepBinding=false
2016-08-07 17:24:11 DEBUG main jndi Adding binding with key=comp obj=Reference Class Name: javax.naming.Context
Type: parser
Content: org.eclipse.jetty.jndi.java.javaNameParser
for context=null as comp: javax.naming.Reference:Reference Class Name: javax.naming.Context
Type: parser
Content: org.eclipse.jetty.jndi.java.javaNameParser
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/FLOCK_APPS_CONFIG"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi supportDeepBinding=false
2016-08-07 17:24:11 DEBUG main jndi Made context comp for classloader: WebAppClassLoader=note@3498ed
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/FLOCK_APPS_CONFIG"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@2925bf5b
2016-08-07 17:24:11 DEBUG main jndi Looking up name="FLOCK_APPS_CONFIG"
2016-08-07 17:24:11 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from URL [file:config.sample]
2016-08-07 17:24:11 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from URL [file:config.sample]
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@fa4c865
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/note.jdbc.url"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/note.jdbc.url"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@3bd82cf5
2016-08-07 17:24:11 DEBUG main jndi Looking up name="note.jdbc.url"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@544fa968
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/note.jdbc.username"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/note.jdbc.username"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@247bddad
2016-08-07 17:24:11 DEBUG main jndi Looking up name="note.jdbc.username"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@d35dea7
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/note.jdbc.password"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/note.jdbc.password"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7770f470
2016-08-07 17:24:11 DEBUG main jndi Looking up name="note.jdbc.password"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@5e5d171f
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/medusa.endpoint"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/medusa.endpoint"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@24313fcc
2016-08-07 17:24:11 DEBUG main jndi Looking up name="medusa.endpoint"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7d20d0b
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/medusa.secret"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/medusa.secret"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@77f1baf5
2016-08-07 17:24:11 DEBUG main jndi Looking up name="medusa.secret"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@41a2befb
2016-08-07 17:24:11 DEBUG main jndi Looking up name="comp/env/medusa.appName"
2016-08-07 17:24:11 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:11 DEBUG main jndi Looking up name="env/medusa.appName"
2016-08-07 17:24:11 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:11 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6c40365c
2016-08-07 17:24:11 DEBUG main jndi Looking up name="medusa.appName"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@4816278d
2016-08-07 17:24:12 DEBUG main jndi Looking up name="comp/env/spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:12 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:12 DEBUG main jndi Looking up name="env/spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@4eaf3684
2016-08-07 17:24:12 DEBUG main jndi Looking up name="spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:12 INFO main org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization completed in 859 ms
2016-08-07 17:24:12 INFO main org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization completed in 859 ms
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7cbd9d24
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6f19ac19
2016-08-07 17:24:12 INFO main / Initializing Spring FrameworkServlet 'SpringDispatcher'
2016-08-07 17:24:12 INFO main org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'SpringDispatcher': initialization started
2016-08-07 17:24:12 INFO main org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'SpringDispatcher': initialization started
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@79dc5318
2016-08-07 17:24:12 DEBUG main jndi Looking up name="comp/env/spring.profiles.active"
2016-08-07 17:24:12 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:12 DEBUG main jndi Looking up name="env/spring.profiles.active"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@8e50104
2016-08-07 17:24:12 DEBUG main jndi Looking up name="spring.profiles.active"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@37e4d7bb
2016-08-07 17:24:12 DEBUG main jndi Looking up name="comp/env/spring.profiles.default"
2016-08-07 17:24:12 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:12 DEBUG main jndi Looking up name="env/spring.profiles.default"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6f7923a5
2016-08-07 17:24:12 DEBUG main jndi Looking up name="spring.profiles.default"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@74a6f9c1
2016-08-07 17:24:12 DEBUG main jndi Looking up name="comp/env/spring.profiles.default"
2016-08-07 17:24:12 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:12 DEBUG main jndi Looking up name="env/spring.profiles.default"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@54eb2b70
2016-08-07 17:24:12 DEBUG main jndi Looking up name="spring.profiles.default"
2016-08-07 17:24:12 INFO main org.springframework.web.context.support.XmlWebApplicationContext Refreshing WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:12 INFO main org.springframework.web.context.support.XmlWebApplicationContext Refreshing WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:12 INFO main org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [spring/servlet-context.xml]
2016-08-07 17:24:12 INFO main org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [spring/servlet-context.xml]
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6127a7e
2016-08-07 17:24:12 DEBUG main jndi Looking up name="comp/env/FLOCK_APPS_CONFIG"
2016-08-07 17:24:12 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:12 DEBUG main jndi Looking up name="env/FLOCK_APPS_CONFIG"
2016-08-07 17:24:12 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:12 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6bbe2511
2016-08-07 17:24:12 DEBUG main jndi Looking up name="FLOCK_APPS_CONFIG"
2016-08-07 17:24:12 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from URL [file:config.sample]
2016-08-07 17:24:12 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from URL [file:config.sample]
2016-08-07 17:24:12 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from class path resource [app.properties]
2016-08-07 17:24:12 INFO main org.springframework.context.support.PropertySourcesPlaceholderConfigurer Loading properties file from class path resource [app.properties]
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@2e9fda69
2016-08-07 17:24:13 DEBUG main jndi Looking up name="webappResourcePrefix:@null"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@17cdf2d0
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/webappResourcePrefix"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/webappResourcePrefix"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@1755e85b
2016-08-07 17:24:13 DEBUG main jndi Looking up name="webappResourcePrefix"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@736d6a5c
2016-08-07 17:24:13 DEBUG main jndi Looking up name="enableLink:false"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@2371aaca
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/enableLink"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/enableLink"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@5b529706
2016-08-07 17:24:13 DEBUG main jndi Looking up name="enableLink"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@63fdab07
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/application.version"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/application.version"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7b5a12ae
2016-08-07 17:24:13 DEBUG main jndi Looking up name="application.version"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@5553d0f5
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/application.buildNumber"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/application.buildNumber"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@14dda234
2016-08-07 17:24:13 DEBUG main jndi Looking up name="application.buildNumber"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@3f390d63
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/appSecret"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/appSecret"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@74a6a609
2016-08-07 17:24:13 DEBUG main jndi Looking up name="appSecret"
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Mapped URL path [/flock-notes/resources/lib/ckeditor/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Mapped URL path [/flock-notes/resources/lib/ckeditor/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Mapped URL path [/flock-notes/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1'
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Mapped URL path [/flock-notes/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1'
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/status],methods=[GET]}" onto public void org.directi.code.controller.NoteController.status(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/status],methods=[GET]}" onto public void org.directi.code.controller.NoteController.status(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.newNote(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.newNote(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes],methods=[POST],consumes=[application/json]}" onto public void org.directi.code.controller.NoteController.createNote(org.directi.code.model.Note,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes],methods=[POST],consumes=[application/json]}" onto public void org.directi.code.controller.NoteController.createNote(org.directi.code.model.Note,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.showNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.showNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/frame],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.iframeBody(java.lang.String) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/frame],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.iframeBody(java.lang.String) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}],methods=[PUT],consumes=[application/json]}" onto public void org.directi.code.controller.NoteController.updateNote(org.directi.code.model.Note,java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}],methods=[PUT],consumes=[application/json]}" onto public void org.directi.code.controller.NoteController.updateNote(org.directi.code.model.Note,java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/edit],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.editNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/edit],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.editNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/preview],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.previewNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/flock-notes/notes/{id}/preview],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView org.directi.code.controller.NoteController.previewNote(java.lang.String,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest)
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringDispatcher-servlet': startup date [Sun Aug 07 17:24:12 IST 2016]; parent: Root WebApplicationContext
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@681aad3b
2016-08-07 17:24:13 DEBUG main jndi Looking up name="comp/env/spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:13 DEBUG main jndi Trying thread context classloader
2016-08-07 17:24:13 DEBUG main jndi Looking up name="env/spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:13 DEBUG main jndi InitialContextFactory.getInitialContext()
2016-08-07 17:24:13 DEBUG main jndi Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@1a6f2363
2016-08-07 17:24:13 DEBUG main jndi Looking up name="spring.liveBeansView.mbeanDomain"
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'SpringDispatcher': initialization completed in 1141 ms
2016-08-07 17:24:13 INFO main org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'SpringDispatcher': initialization completed in 1141 ms
2016-08-07 17:24:56 WARN qtp1940030785-14 org.springframework.http.converter.json.MappingJackson2HttpMessageConverter Failed to evaluate deserialization for type [simple type, class org.directi.code.model.Note]: com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "markdown": org.directi.code.model.Note#setMarkdown(1 params) vs org.directi.code.model.Note#setMarkdown(1 params)
2016-08-07 17:24:56 WARN qtp1940030785-14 org.springframework.http.converter.json.MappingJackson2HttpMessageConverter Failed to evaluate deserialization for type [simple type, class org.directi.code.model.Note]: com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "markdown": org.directi.code.model.Note#setMarkdown(1 params) vs org.directi.code.model.Note#setMarkdown(1 params)
2016-08-07 17:24:56 ERROR qtp1940030785-14 org.directi.code.controller.NoteController An unexpected error occurred
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:226)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:148)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:125)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:78)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
2016-08-07 17:24:56 WARN qtp1940030785-14 org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver Handler execution resulted in exception: Content type 'application/json;charset=UTF-8' not supported
2016-08-07 17:24:56 WARN qtp1940030785-14 org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver Handler execution resulted in exception: Content type 'application/json;charset=UTF-8' not supported
The post request that i am making has the following json :
"{"title":"Title","body":"
Here is the handler function for this post request :
@RequestMapping(value = "/notes", method = RequestMethod.POST, consumes = "application/json")
public void createNote(@RequestBody Note note, HttpServletResponse response, HttpServletRequest request) throws IOException {
The issue is in Note class. Currently the class is :
package org.directi.code.model;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.springframework.web.util.HtmlUtils;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Note {
private String id;
private String title;
private String body;
private String preview;
private int previewHeight;
private String markdown;
private boolean isMarkdown;
public boolean isMarkdown() {
return isMarkdown;
}
public void setMarkdown(boolean markdown) {
isMarkdown = markdown;
}
public String getMarkdown() {
return markdown;
}
public void setMarkdown(String markdown) {
this.markdown = markdown;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public String getPreview() {
return preview;
}
public void setPreview(String preview) {
this.preview = preview;
}
public void setBody(String body) {
this.body = body;
}
public void parseHtml() {
title = HtmlUtils.htmlEscape(title);
}
public int getPreviewHeight() {
return previewHeight;
}
public void setPreviewHeight(int previewHeight) {
this.previewHeight = previewHeight;
}
}
The two setter with same name is probably causing the conflict . How do i resolve this ?
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Are you trying to call the service through rest client?
if yes
please change your http type to post in rest client browser.
if yes
please change your http type to post in rest client browser.
ASKER
private boolean flag;
In the class i was using previously :
private String markdown;
private boolean isMarkdown;
public boolean isMarkdown() {
return isMarkdown;
}
public void setMarkdown(boolean markdown) {
isMarkdown = markdown;
}
public String getMarkdown() {
return markdown;
}
public void setMarkdown(String markdown) {
this.markdown = markdown;
}
probably i should remove the flag field altogether. I cant think of a better name or alternative name then isMarkdown.
But then this getter setter cause trouble.