On Wed, Apr 1, 2015 at 9:33 PM, Ed Welch <[email protected]> wrote: > Ok, I've spent the bulk of my day on this, and have met with some success. > > There are a few other gotcha's trying to get swagger to run from karaf. > (some issues were fought based on my application, for example, i was using > guava 18, however swagger brings with it guava 15 creating some dependency > chain nightmares...) > > The first "real" issue was with the RBAC setup in newer karaf versions. The > DefaultCamelSwaggerServlet tries to execute "dumpRestsAsXml" and karaf will > not allow it. > > To fix this I created etc/jmx.acl.org.apache.camel.context.cfg with contents: > > dumpRestsAsXml = * > > This should probably go into the camel-swagger feature? >
Yeah the rbac in karaf unfortuntately has this side-effect. We had to do something similar for hawtio-karaf to allow it to discover 3rd party installed hawtio plugins https://github.com/hawtio/hawtio/blob/master/hawtio-karaf/src/main/resources/features.xml#L11 So something similar should be added to camel-swagger. You are welcome to log a JIRA and work on a patch. > Second problem, my application has multiple camel servlets, and the class > mentioned above essentially just picks the last one it enumerates, unless the > camelId init-param is set on the servlet config. > > So to get DefaultCamelSwaggerServlet to pick the correct mbean to invoke > dumpRestAsXml, I had to add this to my web.xml inside the > DefaultCamelSwaggerServlet definition: > > <init-param> > <param-name>camelId</param-name> > <param-value>"elnk-jhm-main"</param-value> > </init-param> > > where elnk-jhm-main is the name of my camel context containing my rest routes > > NOTE: the quotes were required here. > > camelId is currently not documented on the wiki page, and it seems like > DefaultCamelSwaggerServlet should probably be modified so that it strips the > quotes when doing the .equals on camelId, so that the param-value doesn't > need quotes. > > > I got all this working, and was a little surprised to just see a json output > (was expecting the swagger web ui). So i built and ran the camel tomcat > servlet example which has swagger configured, and upon snooping around that > project realized you still need to do a bunch of additional work to actually > include the swagger ui into your project (all done in the pom.xml of that > example project) > > This is fine, and apparent to me now, but my expectation going into this was > more along the lines of once I had the camel-swagger stuff configured in my > servlet, bam, i would have swagger running. It might be worth updating the > wiki to mention the pom.xml configs for downloading/extracting/installing > swagger are required still. > camel-swagger is for exposing the rest-dsl in swagger api json notation, not a repackage of any 3rd party swagger web consoles - that is not the scope. > All in all I made good progress, I'm willing to either help with the > documentation updates or the karaf feature config if any help is needed. > please let me know! > Sure we love contributions http://camel.apache.org/contributing.html > Thanks, > Ed > > > On Wed, 1 Apr 2015 16:42:40 +0200, Claus Ibsen <[email protected]> wrote: > >> Hi >> >> See the known issue section at >> http://camel.apache.org/camel-2150-release.html >> >> On Wed, Apr 1, 2015 at 4:24 PM, Ed Welch <[email protected]> wrote: >> > With the release of 2.15.1 fixing a bug that prevented 2.15 from working >> > in an OSGi environment, figured I'd give camel-swagger feature a try... >> > >> > 2015-04-01 09:52:38,672 | ERROR | qtp3964738-67 | FeaturesPlugin >> > | 88 - org.apache.karaf.webconsole.features - 3.0.3 | Can't >> > install feature camel-swagger/2.15.1 >> > java.lang.IllegalStateException: Can't install feature >> > camel-swagger/2.15.1: >> > Could not start bundle >> > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-core/1.3.12_1 >> > in feature(s) camel-swagger-2.15.1: Unresolved constraint in bundle >> > org.apache.servicemix.bundles.swagger-core [111]: Unable to resolve 111.0: >> > missing requirement [111.0] osgi.wiring.package; >> > (&(osgi.wiring.package=scala.reflect.api)(version>=2.10.0)(!(version>=3.0.0))) >> > >> > Vanilla Karaf 3.0.3 >> > >> > Am I missing something or should I file a bug? >> > >> > Thanks! >> > Ed >> >> >> >> -- >> Claus Ibsen >> ----------------- >> Red Hat, Inc. >> Email: [email protected] >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> hawtio: http://hawt.io/ >> fabric8: http://fabric8.io/ > > -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
