Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rest Server Returns HTTP 405 Error

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all and thanks for reading my post!

I’m trying to get my client communicating with the Rest server. I found this link: http://www.theserverside.com/tip/RESTful-Web-services-made-easy.
When I try to invoke a simple service using the example code, I get “HTTP Status 405 - specified HTTP method is not allowed for the requested
resource ()”. The web.xml in the example shows a servlet mapping to a Jersey ServletContainer. I’m not using Jersey; is there a different
ServletContainer I should use instead? If I do, will this conflict with the HttpServletDispatcher?

Web.xml


Service Class:


Environment: Windows 7, JBoss 5.1, Java 1.6, Eclipse Helios Release 2.
Thanks!
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured out my issue:

You need to set the “resteasy.servlet.mapping.prefix” if your servlet-mapping for the resteasy servlet has a url-pattern other than “/*“.

The resteasy servlet url-pattern is “/rest/*“, so you have to set the “resteasy.servlet.mapping.prefix” to “/rest” as well, otherwise, you will hit resource not found error message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic