hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Codebase needs to be hardened for production use. #117

Closed hsyed closed 8 years ago

hsyed commented 8 years ago

The publisher implementation needs to be made more defensive, have logging (be informative in general) and fail early and fail hard when it can't bring itself up. The ServletContainerBridge run method specifically needs to be hardened for production use. I can't imagine going to production with dozens of features, resources, filters, AbstractBinders etc and having a problem.

I'm working on replacing Spring/Karaf with Jax-RS / Karaf. I've lost 3 days in total over the last three weeks to various issues that are indecipherable till you understand all the moving parts in place (Jersey, pax-web, Http Service, Karaf, Bundles and dependencies in environment etc). 65% of the problems hung on a "Jersey is not available" error with no way to figure out if it's bundle load sequencing, bundle wiring, my use of the jax-rs-connector, the HttpService, my container etc etc.

The run method in the ServletContainerBridge has been the focus point for all the errors I have faced:

  1. It does not handle exceptions.
  2. It does not put itself in a failure state.
  3. it does nothing to inform the user about what is wrong.

I've now embedded the publisher source code in my own framework bundle in Karaf and I am adding shell commands to introspect the state of jersey etc. I've also started hardening the code. I'm doing this in Scala (Shell commands) and with log4j (extending the publisher with logging) so I doubt it will be of general use.

The snippet below is what I am using for now.

https://gist.github.com/hsyed/76573e255c8de6d2f83b

hstaudacher commented 8 years ago

any pull request is welcome :)

hstaudacher commented 8 years ago

Closing this now. The connector is used in production for many projects. As I said, any pull request is welcome.