Skip to content

Cannot invoke "java.util.Map.size()" because "map" is null #116

Open
@nobody102

Description

@nobody102

wildfly 27. Using swagger maven plugin, with JDK 21, and getting the above error.



io.openapitools.swagger
swagger-maven-plugin

            <configuration>
                <resourcePackages>
                    <resourcePackage>com.hsntech.bannerjwt.rest</resourcePackage>
                </resourcePackages>
                <outputDirectory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}</outputDirectory>
                <outputFilename>openapi</outputFilename>
                <outputFormats>
                    <outputFormat>JSON</outputFormat>
                    <outputFormat>YAML</outputFormat>
                </outputFormats>
                <prettyPrint>true</prettyPrint>
                <swaggerConfig>
                    <servers>
                        <server>
                            <url>/SecurityService/rest</url>
                            <description>Endpoint URL for Banner Security Service API's</description>
                        </server>
                    </servers>
                    <info>
                        <title>Security Service - OpenAPI</title>
                        <version>1.0.0</version>

                        <description>REST API Framework designed to allow third party vendors the ability to
                            access Banner client data without having to go through the Banner UI Framework.</description>
                    </info>
                </swaggerConfig>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <!-- Download Swagger UI webjar. -->
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${maven-dependency-plugin.version}</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.webjars</groupId>
                                <artifactId>swagger-ui</artifactId>
                                <version>${swagger-ui.version}</version>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <!-- Add Swagger UI resources to the war file. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven-war-plugin.version}</version>
            <configuration>
                <webResources combine.children="append">
                    <resource>
                        <directory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}</directory>
                        <includes>
                            <include>**/*.*</include>
                        </includes>
                        <targetPath>swagger-ui</targetPath>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
        <plugin>
            <!-- Replace the OpenAPI specification example URL with the local one. -->
            <groupId>com.google.code.maven-replacer-plugin</groupId>
            <artifactId>replacer</artifactId>
            <version>${replacer.version}</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>replace</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <file>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/index.html</file>
                <replacements>
                    <replacement>
                        <token>http://petstore.swagger.io/v2/swagger.json</token>
                        <!-- value>/api/openapi.json</value -->
                        <!-- value>'http://localhost:8080/SecurityService/openapi.json'</value -->
                        <value>openapi.yaml</value>
                    </replacement>
                </replacements>
            </configuration>
        </plugin>
    </plugins>
</build>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions