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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.