java - Request method 'POST' not supported and amazon elastic beantalk -


trying use post method in controller java annotation ( version 4.2.1)and success in local tomcat, when moved amazon beantalk follow error:

log:

28-sep-2015 10:34:11.339 warning [http-nio-8080-exec-10] org.springframework.web.servlet.pagenotfound.handlehttprequestmethodnotsupported request method 'post' not supported 28-sep-2015 10:34:11.340 warning [http-nio-8080-exec-10] org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver.logexception handler execution resulted in exception: request method 'post' not supported 28-sep-2015 10:34:11.994 warning [http-nio-8080-exec-1] org.springframework.web.servlet.pagenotfound.handlehttprequestmethodnotsupported request method 'post' not supported 28-sep-2015 10:34:11.995 warning [http-nio-8080-exec-1] org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver.logexception handler execution resulted in exception: request method 'post' not supported 28-sep-2015 10:34:15.915 warning [http-nio-8080-exec-9] org.springframework.web.servlet.pagenotfound.handlehttprequestmethodnotsupported request method 'post' not supported 28-sep-2015 10:34:15.915 warning [http-nio-8080-exec-9] org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver.logexception handler execution resulted in exception: request method 'post' not supported 28-sep-2015 10:34:16.938 warning [http-nio-8080-exec-5] org.springframework.web.servlet.pagenotfound.handlehttprequestmethodnotsupported request method 'post' not supported 28-sep-2015 10:34:16.938 warning [http-nio-8080-exec-5] org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver.logexception handler execution resulted in exception: **request method 'post' not supported** 28-sep-2015 10:34:17.660 warning [http-nio-8080-exec-10] org.springframework.web.servlet.pagenotfound.handlehttprequestmethodnotsupported request method 'post' not supported  

appconfig.java:

@configuration @componentscan(basepackages={"service","controller"}) public class appconfig {  public appconfig(){          system.out.println("appconfig!!!!!!!!!!!!!!!!!!!!!");     }      @autowired       private applicationcontext applicationcontext;        /**        * actor system singleton application.        */       @bean (name="actorsystem")       public actorsystem actorsystem() {           system.out.println("system issssssssssssssssssssssssss" );           try {               actorsystem system = actorsystem.create("akkajavaspring");               system.out.println("system issssssssssssssssssssssssss2222222222" );                  // initialize application context in akka spring extension                 springextprovider.get(system).initialize(applicationcontext);                 return system;         } catch (exception e) {             system.err.println("actorsystem initialized exception: " + e);         }            system.err.println("no exception!!!!!!!!!!!!!!!!!!!!" );         return null;       } 

abstractannotationconfigdispatcherservletinitializer:

public class dispatcherservletinitializer  extends abstractannotationconfigdispatcherservletinitializer {      @override     protected class<?>[] getrootconfigclasses() {         system.out.println("getrootconfigclasses!!!!!!!!!!!!!! succed");         return new class<?>[] {             webconfig.class,             appconfig.class         };     }      @override     protected class<?>[] getservletconfigclasses() {         return null;     }      @override     protected string[] getservletmappings() {         return new string[] { "/" };     }      @override     protected filter[] getservletfilters() {         system.out.println("filter !!!!!!!!!!!!!! succed");         return new filter[] { new hiddenhttpmethodfilter() };     }  } 

webconfig:

@configuration @enablewebmvc public class webconfig extends webmvcconfigureradapter{      @override       public void configurecontentnegotiation(contentnegotiationconfigurer configurer) {  //      configurer.ignoreacceptheader(true).defaultcontenttype( //              mediatype.application_json);          configurer.favorpathextension(false).                 favorparameter(true).                 parametername("mediatype").                 ignoreacceptheader(true).                 usejaf(false).                 defaultcontenttype(mediatype.application_json).                 mediatype("xml", mediatype.application_xml).                 mediatype("json", mediatype.application_json);        }      @override       public void addresourcehandlers(resourcehandlerregistry registry) {           registry.addresourcehandler("/**").addresourcelocations("/");        } 

controller:

@restcontroller @requestmapping(value="/api/mail") public class sendmailcontroller {       //dispatcher dispatcher;       //@autowired     public sendmailcontroller(){         //this.dispatcher = dispatcher;         system.out.println("sendmailcontroller has been loaded!!!!!!!!!!!!!!!!!!!!!");     }        @requestmapping(produces = "application/json" ,method=requestmethod.post )      public responseentity<httpstatus> sendmail(@requestbody mailrequest mailrequest){          system.out.println("mailrequest 2 mailrequest!!!!!!!!!!!!!!!!!!! " );      //  dispatcher.sendmail(new mailrequestevent(mailrequest));         return new responseentity<httpstatus>(httpstatus.ok);     }  } 

please relly need here

the problem in url there different between url tomcat , url elastic deferent elastic don't include project name in url , in tomcat have include project name

thanks


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -