You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christina Lin <cl...@redhat.com> on 2015/05/21 12:48:12 UTC

Problem with swagger in the camel-example-servlet-rest-tomcat

I wanted to see how swagger works, but is having trouble with the 
"camel-example-servlet-rest-tomcat" quickstart example. After packaging it,
and placing the WAR file in Tomcat 8.0.22. I was able play with the rest
service without any problem. 

BUT, I was not able to get the
"http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs" swagger
API page working. 

It shows a NullPointerException. Is there a specific version of Tomcat that
we need to use? 

java.lang.NullPointerException

org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$createParameters$2.apply(RestSwaggerReader.scala:190)

org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$createParameters$2.apply(RestSwaggerReader.scala:179)

scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
	scala.collection.Iterator$class.foreach(Iterator.scala:727)
	scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
	scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
	scala.collection.AbstractIterable.foreach(Iterable.scala:54)

scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)

org.apache.camel.component.swagger.RestSwaggerReader.createParameters(RestSwaggerReader.scala:179)

org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$read$2.apply(RestSwaggerReader.scala:123)

org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$read$2.apply(RestSwaggerReader.scala:70)

scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)

scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
	scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)

scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)

org.apache.camel.component.swagger.RestSwaggerReader.read(RestSwaggerReader.scala:70)

org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1$$anonfun$apply$1.apply(RestApiListingCache.scala:42)

org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1$$anonfun$apply$1.apply(RestApiListingCache.scala:41)
	scala.collection.immutable.List.foreach(List.scala:318)

scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
	scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)

org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1.apply(RestApiListingCache.scala:41)

org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1.apply(RestApiListingCache.scala:38)
	scala.Option.orElse(Option.scala:257)

org.apache.camel.component.swagger.RestApiListingCache$.listing(RestApiListingCache.scala:38)

org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.renderResourceListing(RestSwaggerApiDeclarationServlet.scala:171)

org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.doGet(RestSwaggerApiDeclarationServlet.scala:98)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.apache.camel.component.swagger.RestSwaggerCorsFilter.doFilter(RestSwaggerCorsFilter.scala:44)  



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-swagger-in-the-camel-example-servlet-rest-tomcat-tp5767376.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with swagger in the camel-example-servlet-rest-tomcat

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Okay thanks. There has been some swagger improvements for 2.16.

So maybe it broke something in the example.
You are welcome to log a JIRA so we wont forget about this - as its
maybe sometimes a bit easy to not test the example but all the unit
tests works.
http://camel.apache.org/support

On Thu, May 21, 2015 at 2:34 PM, Christina Lin <cl...@redhat.com> wrote:
> I was using the latest snapshot.
> After your replay,
> I checked again with the 2.15.x branch, and it worked!!!
>
> Thanks!
>
> -Christina
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-swagger-in-the-camel-example-servlet-rest-tomcat-tp5767376p5767381.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Problem with swagger in the camel-example-servlet-rest-tomcat

Posted by Christina Lin <cl...@redhat.com>.
I was using the latest snapshot. 
After your replay, 
I checked again with the 2.15.x branch, and it worked!!! 

Thanks!

-Christina



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-swagger-in-the-camel-example-servlet-rest-tomcat-tp5767376p5767381.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with swagger in the camel-example-servlet-rest-tomcat

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel do you use? And what JDK version?

On Thu, May 21, 2015 at 12:48 PM, Christina Lin <cl...@redhat.com> wrote:
> I wanted to see how swagger works, but is having trouble with the
> "camel-example-servlet-rest-tomcat" quickstart example. After packaging it,
> and placing the WAR file in Tomcat 8.0.22. I was able play with the rest
> service without any problem.
>
> BUT, I was not able to get the
> "http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs" swagger
> API page working.
>
> It shows a NullPointerException. Is there a specific version of Tomcat that
> we need to use?
>
> java.lang.NullPointerException
>
> org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$createParameters$2.apply(RestSwaggerReader.scala:190)
>
> org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$createParameters$2.apply(RestSwaggerReader.scala:179)
>
> scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
>         scala.collection.Iterator$class.foreach(Iterator.scala:727)
>         scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
>         scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
>         scala.collection.AbstractIterable.foreach(Iterable.scala:54)
>
> scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
>
> org.apache.camel.component.swagger.RestSwaggerReader.createParameters(RestSwaggerReader.scala:179)
>
> org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$read$2.apply(RestSwaggerReader.scala:123)
>
> org.apache.camel.component.swagger.RestSwaggerReader$$anonfun$read$2.apply(RestSwaggerReader.scala:70)
>
> scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
>
> scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
>         scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
>
> scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
>
> org.apache.camel.component.swagger.RestSwaggerReader.read(RestSwaggerReader.scala:70)
>
> org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1$$anonfun$apply$1.apply(RestApiListingCache.scala:42)
>
> org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1$$anonfun$apply$1.apply(RestApiListingCache.scala:41)
>         scala.collection.immutable.List.foreach(List.scala:318)
>
> scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
>         scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
>
> org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1.apply(RestApiListingCache.scala:41)
>
> org.apache.camel.component.swagger.RestApiListingCache$$anonfun$listing$1.apply(RestApiListingCache.scala:38)
>         scala.Option.orElse(Option.scala:257)
>
> org.apache.camel.component.swagger.RestApiListingCache$.listing(RestApiListingCache.scala:38)
>
> org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.renderResourceListing(RestSwaggerApiDeclarationServlet.scala:171)
>
> org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.doGet(RestSwaggerApiDeclarationServlet.scala:98)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>         org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>
> org.apache.camel.component.swagger.RestSwaggerCorsFilter.doFilter(RestSwaggerCorsFilter.scala:44)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-swagger-in-the-camel-example-servlet-rest-tomcat-tp5767376.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/