Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-4884

Swagger Feature throws NullPointerException if using non-default HTTP Port

XMLWordPrintable

    • % %
    • Hide
      • Slightly modify the quickstart here, jboss-fuse-6.2.1.redhat-084/quickstarts/cxf/rest to have blueprint file as mentioned in the description.
      • Attached is the reproducer, rest.zip.
      • When you hit the request with the url, 'http://localhost:9000/swaggerFeature/api-docs', you can see 'Error: 500' and the NPE in the fuse logs
      • The reproducer works fine in Fuse 6.1. We don't see any issue there.
      • Workaround is to use the 'swagger-maven-plugin'.
      Show
      Slightly modify the quickstart here, jboss-fuse-6.2.1.redhat-084/quickstarts/cxf/rest to have blueprint file as mentioned in the description. Attached is the reproducer, rest.zip. When you hit the request with the url, 'http://localhost:9000/swaggerFeature/api-docs', you can see 'Error: 500' and the NPE in the fuse logs The reproducer works fine in Fuse 6.1. We don't see any issue there. Workaround is to use the 'swagger-maven-plugin'.
    • 6.3 Sprint 4 (Mar 28 - Apr 29)

      • When accessing swagger /api-docs with jax-rs server configured with a non-default HTTP port (e.g http://localhost:9000/api), Swagger API throws NullPointerException.
      • If the configuration of jaxrs server is like below,
      <jaxrs:server id="customerService" address="http://localhost:9000/swaggerFeature">
              <jaxrs:serviceBeans>
                  <ref component-id="customerSvc"/>
              </jaxrs:serviceBeans>
              <jaxrs:providers>
                 <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
              </jaxrs:providers>
              <!--<jaxrs:features>
                  <bean class="io.fabric8.cxf.endpoint.SwaggerFeature">
                      <property name="title" value="Fabric8:CXF:Quickstarts - Customer Service" />
                      <property name="description" value="Sample REST-based Customer Service" />
                      <property name="version" value="6.2.1.redhat-084" />
                  </bean>
              </jaxrs:features>-->
      	<jaxrs:features>
      		<bean class="org.apache.cxf.jaxrs.swagger.SwaggerFeature" />
      	</jaxrs:features>
          </jaxrs:server>
       
          <cxf:bus>
              <cxf:features>
                <cxf:logging />
              </cxf:features>
          </cxf:bus> 
          <bean id="customerSvc" class="io.fabric8.quickstarts.rest.CustomerService"/>
      

      you get the below NPE logging in the Fuse logs,

      15:38:57,819 | WARN  | qtp186369606-221 | PhaseInterceptorChain            | 74 - org.apache.cxf.cxf-core - 3.0.4.redhat-621084 | Application {http://rest.quickstarts.fabric8.io/}CustomerService has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault
      	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:129)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)[103:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.4.redhat-621084]
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)[103:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.4.redhat-621084]
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)[96:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-621084]
      	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)[205:org.apache.cxf.cxf-rt-transports-http-jetty:3.0.4.redhat-621084]
      	at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)[205:org.apache.cxf.cxf-rt-transports-http-jetty:3.0.4.redhat-621084]
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.Server.handle(Server.java:370)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[86:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
      	at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
      Caused by: java.lang.NullPointerException
      	at com.wordnik.swagger.jaxrs.listing.ApiListingCache$.listing(ApiListing.scala:38)[117:org.apache.servicemix.bundles.swagger-jaxrs:1.3.2.3]
      	at com.wordnik.swagger.jaxrs.listing.ApiListingResource.resourceListing(ApiListing.scala:94)[117:org.apache.servicemix.bundles.swagger-jaxrs:1.3.2.3]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_65]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_65]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_65]
      	at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_65]
      	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
      

            rhn-support-tasato Tadayoshi Sato
            rhn-support-vgohel Viral Gohel
            Jan Bouska Jan Bouska
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: