You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicemix.apache.org by "Tadayoshi Sato (JIRA)" <ji...@apache.org> on 2017/05/09 10:26:04 UTC

[jira] [Created] (SM-3342) swagger-jaxrs may throw NPE when non-default HTTP port is used with CXF

Tadayoshi Sato created SM-3342:
----------------------------------

             Summary: swagger-jaxrs may throw NPE when non-default HTTP port is used with CXF
                 Key: SM-3342
                 URL: https://issues.apache.org/jira/browse/SM-3342
             Project: ServiceMix
          Issue Type: Bug
          Components: bundles
    Affects Versions: bundles-2017.04
            Reporter: Tadayoshi Sato


When accessing swagger {{/api-docs}} with CXF JAX-RS server configured with a non-default HTTP port (e.g {{http://localhost:9000/crm}}), Swagger API throws {{NullPointerException}}.

If the configuration of CXF {{<jaxrs:server>}} is like below:

{code:java}
     <jaxrs:server id="customerService" address="http://0.0.0.0:9000/crm">
        <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="${project.version}" />
            </bean>
        </jaxrs:features>
    </jaxrs:server>
{code}

you get the below NPE logging in the Fuse logs:

{code}
2017-05-09 14:14:58,241 | ERROR | tp1652831467-680 | tractFaultChainInitiatorObserver | 73 - org.apache.cxf.cxf-core - 3.0.4.redhat-621197 | Error occurred during error handling, give up!
org.apache.cxf.interceptor.Fault
	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:129)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)[102:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.4.redhat-621197]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)[102:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.4.redhat-621197]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)[95:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-621197]
	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)[213:org.apache.cxf.cxf-rt-transports-http-jetty:3.0.4.redhat-621197]
	at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)[213:org.apache.cxf.cxf-rt-transports-http-jetty:3.0.4.redhat-621197]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.Server.handle(Server.java:370)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:973)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1035)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:641)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:231)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[85:org.eclipse.jetty.aggregate.jetty-all-server:8.2.0.v20160908]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.lang.NullPointerException
	at com.wordnik.swagger.jaxrs.listing.ApiListingCache$.listing(ApiListing.scala:38)[119:org.apache.servicemix.bundles.swagger-jaxrs:1.3.12.2]
	at com.wordnik.swagger.jaxrs.listing.ApiListingResource.resourceListing(ApiListing.scala:94)[119:org.apache.servicemix.bundles.swagger-jaxrs:1.3.12.2]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_121]
	at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_121]
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)[73:org.apache.cxf.cxf-core:3.0.4.redhat-621197]
	... 26 more
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)