Swagger Feature throws NullPointerException if using non-default HTTP Port

Solution Verified - Updated -

Issue

  • 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.

However, we are able access api-docs if address is configured as "/api".

  • Here is the configuration of jaxrs server. Exception log is attached for your reference.

    <jaxrs:server id="api-server" address="http://localhost:9000/api">
        <jaxrs:serviceBeans>
            <ref component-id="customerSvc"></ref>
        </jaxrs:serviceBeans>
        <jaxrs:features>
            <ref component-id="swaggerFeature"></ref>
        </jaxrs:features>
        <jaxrs:providers>
            <ref component-id="cors-filter"></ref>
            <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"></bean>
        </jaxrs:providers>
    </jaxrs:server>
    <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"></bean>
    <bean id="customerSvc" class="com.redhat.CustomerService"></bean>
    

Environment

  • Red Hat JBoss Fuse
    • 6.2.1
  • Swagger

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content