I am trying to hook up a dropwizard 0.8.* application, and I have used a hello world starter example.
The code is left untouched and the application starts-up normally.
Though when I try to access the path assigned to the hello world GET request, the browser returns a :
HTTP ERROR 404
Problem accessing /hello-world. Reason:
Not Found
This is kinda strange since the app logs say otherwise and return 200 for that request:
0:0:0:0:0:0:0:1 - - [15/Sep/2015:07:33:58 +0000] "GET /hello-world HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36" 0
Am I missing anything in terms of configuration or else ? I am running under OSX and google Chrome.
Adding more information I have tried two different hello-world examples and both fail. On top with spring boot and also akka-http I have no problems.
The simplest way is to return an Optional<MyObject> . Dropwizard will automatically throw a 404 when your result is Optional. absent() or Optional.
Jetty: You would require HTTP for running a web application. Dropwizard embeds the Jetty servlet container for running web applications. Instead of deploying your applications to an application server or web server, Dropwizard defines a main method that invokes the Jetty server as a standalone process.
I had the same issue,
While starting the server it says "MutableServletContextHandler@4b2a30d{/application,null,AVAILABLE}"
so try /application/hello-world,
It worked for me. (Credit to my friend who helped me :) )
http://tips.tutorialhorizon.com/2015/10/03/dropwizard-0-8-and-jetty-fail-return-404-on-resources/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With