You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Pratibha Ayengar <pr...@gmail.com> on 2021/02/13 11:25:58 UTC

Fwd: Apache geode 1.12.0 swagger UI issue

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
and I am having trouble starting up the REST API. Could you please help me
understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to
start the server. Attached are the geode.properties file used to start the
locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and
server respectively. I have also attached the logs from the server that
does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334
--properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main]
o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main]
o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main]
o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
location:
file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main]
o.a.geode.management.internal.RestAgent  : HttpService is not available -
could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar

RE: Apache geode 1.12.0 swagger UI issue

Posted by Rupert St John Webster <ru...@impress-solutions.com>.
Hmm, I think you are missing a spring boot dependency that needs to contain HttpService.class
Maybe you have to use the @EnableHttpService annotation in your application.

https://docs.spring.io/spring-gemfire/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http

I have no further clue ☺

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
Sent: 16 February 2021 04:52
To: user@geode.apache.org
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())
This is the one that seems to be failing.

Thanks,
Pratibha


On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:
// Check if we're already running inside Tomcat
        if (isRunningInTomcat()) {
            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
            Map<String, Object> securityServiceAttr = new HashMap<>();
            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
            if (cache.getOptionalService(HttpService.class).isPresent()) {
                HttpService httpService = cache.getOptionalService(HttpService.class).get();
                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);
                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);
            } else {
                logger.warn("HttpService is not available - could not start Dev REST API");
            }

Is this any help?

cheers

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:
For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.
With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar


RE: Apache geode 1.12.0 swagger UI issue

Posted by Rupert St John Webster <ru...@impress-solutions.com>.
And also spring-geode-starter-session

With @EnableGemFireHttpSession(poolName="thePool")

From: Rupert St John Webster
Sent: 17 February 2021 07:49
To: user@geode.apache.org
Subject: RE: Apache geode 1.12.0 swagger UI issue

Hi Pratibha,

I think you could try spring-geode-starter

Kind regards

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
Sent: 17 February 2021 04:52
To: user@geode.apache.org
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:
Hi Pratibha,

In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:

start-dev-rest-api=true

In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:

[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode

[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war

[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api

[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...

[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'

[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).

Also, the Swagger UI is only available from servers and is not available on the locator.

Hope this helps.
--Jens

From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())
This is the one that seems to be failing.

Thanks,
Pratibha


On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:
// Check if we're already running inside Tomcat
        if (isRunningInTomcat()) {
            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
            Map<String, Object> securityServiceAttr = new HashMap<>();
            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
            if (cache.getOptionalService(HttpService.class).isPresent()) {
                HttpService httpService = cache.getOptionalService(HttpService.class).get();
                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);
                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);
            } else {
                logger.warn("HttpService is not available - could not start Dev REST API");
            }

Is this any help?

cheers

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:
For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.
With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar


RE: Apache geode 1.12.0 swagger UI issue

Posted by Rupert St John Webster <ru...@impress-solutions.com>.
Hi Pratibha,

I think you could try spring-geode-starter

Kind regards

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
Sent: 17 February 2021 04:52
To: user@geode.apache.org
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:
Hi Pratibha,

In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:

start-dev-rest-api=true

In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:

[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode

[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war

[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api

[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...

[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'

[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).

Also, the Swagger UI is only available from servers and is not available on the locator.

Hope this helps.
--Jens

From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())
This is the one that seems to be failing.

Thanks,
Pratibha


On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:
// Check if we're already running inside Tomcat
        if (isRunningInTomcat()) {
            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
            Map<String, Object> securityServiceAttr = new HashMap<>();
            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
            if (cache.getOptionalService(HttpService.class).isPresent()) {
                HttpService httpService = cache.getOptionalService(HttpService.class).get();
                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);
                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);
            } else {
                logger.warn("HttpService is not available - could not start Dev REST API");
            }

Is this any help?

cheers

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:
For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.
With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar


Re: Apache geode 1.12.0 swagger UI issue

Posted by Pratibha Ayengar <pr...@gmail.com>.
Hi John,

Thank you very much for the detailed email and all the options. I had tried
a few of them like removing the conflicting Spring jars from the war file.
I will give this a shot. I hadn't realised that swagger is the biggest
issue here. I was under the impression that the Developer REST API is not
starting up either. Let me try these options and come back to you.

Thanks,
Pratibha

On Thu, Feb 18, 2021 at 4:54 AM John Blum <jb...@vmware.com> wrote:

> Hi Pratibha-
>
> I cannot seem to put your problem down... :P
>
> Sometime ago, the Apache Geode core engineering team (compliments of *Udo
> Kohlmeyer*, Committer/PMC member) made a fine modification to Geode to
> load the Geode Webapps from the classpath (effectively here
> <https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java#L91> [1],
> then here
> <https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L64> [2],
> and finally, here
> <https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L130-L137> [3]),
> rather than requiring an installation of an Apache Geode distribution (e.g.
> 1.12.0) on your system.
>
> NOTE: These Apache Geode code references are similar to where *Rupert*
> was pointing you earlier.
>
> Additionally, Geode WAR files are published to *Maven Central* along with
> the other module Geode JARs (e.g. geode-core), for example
> <https://search.maven.org/artifact/org.apache.geode/geode-web-api/1.13.1/war> [3],
> the geode-web-api WAR file for the Developer REST API.
>
> I was aware of this approach and tried this before I even responded to you
> the first time, but I ran into some problem I don't recall now and quickly
> switched directions. I wanted revisit this approach as I think it's a nice
> alternative to having to download and install Apache Geode locally. I even
> use this approach for some of the Integration Tests in the SDG and SBDG
> test suites to test certain features and functions.
>
> I got the classpath approach to work, but there are limitations and ever
> persistent problems (yet), again caused by Swagger. 😞 You can see that
> the HTTP service started in the log output:
>
> 2021-02-17 14:55:01.322  INFO 50399 --- [           main]
> o.a.g.i.cache.InternalHttpService        : Enabled InternalHttpService on
> port 7070
> 2021-02-17 14:55:01.322  INFO 50399 --- [           main]
> o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service
> org.apache.geode.internal.cache.InternalHttpService
> 2021-02-17 14:55:01.367  INFO 50399 --- [           main]
> o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service
> org.apache.geode.cache.lucene.internal.LuceneServiceImpl
> 2021-02-17 14:55:02.226  INFO 50399 --- [           main]
> o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service
> org.apache.geode.management.internal.cli.remote.OnlineCommandProcessor
> 2021-02-17 14:55:02.263  INFO 50399 --- [           main]
> o.a.g.internal.cache.DistributedRegion   : Initializing region
> _monitoringRegion_10.99.199.24<v0>41000
> 2021-02-17 14:55:02.265  INFO 50399 --- [           main]
> o.a.g.internal.cache.DistributedRegion   : Initialization of region
> _monitoringRegion_10.99.199.24<v0>41000 completed
> 2021-02-17 14:55:02.310  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-17 14:55:02.310  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> null
> 2021-02-17 14:55:02.310  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME environment variable
> not set; HTTP service will not start.
> 2021-02-17 14:55:02.311  WARN 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : geode-web war file was not found
> 2021-02-17 14:55:02.311  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-17 14:55:02.311  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> null
> 2021-02-17 14:55:02.312  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME environment variable
> not set; HTTP service will not start.
> 2021-02-17 14:55:02.312  WARN 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : geode-pulse war file was not
> found
> 2021-02-17 14:55:02.342  INFO 50399 --- [           main]
> o.a.g.m.internal.ManagementAgent         : Registered AccessControlMBean on
> GemFire:service=AccessControl,type=Distributed
> 2021-02-17 14:55:02.345  INFO 50399 --- [           main]
> o.a.g.m.internal.ManagementAgent         : Registered FileUploaderMBean on
> GemFire:service=FileUploader,type=Distributed
> 2021-02-17 14:55:02.366  INFO 50399 --- [           main]
> org.apache.geode.internal.JarDeployer    : Loading previously deployed jars
> 2021-02-17 14:55:02.371  INFO 50399 --- [           main]
> o.a.g.internal.cache.DistributedRegion   : Initializing region PdxTypes
> 2021-02-17 14:55:02.371  INFO 50399 --- [           main]
> o.a.g.internal.cache.DistributedRegion   : Initialization of region
> PdxTypes completed
> 2021-02-17 14:55:02.373  INFO 50399 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/Users/jblum/.m2/repository/org/apache/geode/geode-web-api/1.13.1/geode-web-api-1.13.1.war
> 2021-02-17 14:55:02.422  INFO 50399 --- [           main]
> o.a.g.i.cache.InternalHttpService        : Adding webapp /gemfire-api
> 2021-02-17 14:55:02.423  INFO 50399 --- [           main]
> o.a.g.i.cache.InternalHttpService        : Attempting to start HTTP service
> on port (7070) at bind-address (0.0.0.0)...
> 2021-02-17 14:55:02.424  INFO 50399 --- [           main]
> org.eclipse.jetty.server.Server          : jetty-9.4.35.v20201120; built:
> 2020-11-20T21:17:03.964Z; git: bdc54f03a5e0a7e280fab27f55c3c75ee8da89fb;
> jvm 1.8.0_241-b07
> 2021-02-17 14:55:03.033  INFO 50399 --- [           main]
> o.e.j.w.StandardDescriptorProcessor      : NO JSP Support for /gemfire-api,
> did not find org.eclipse.jetty.jsp.JettyJspServlet
> 2021-02-17 14:55:03.044  INFO 50399 --- [           main]
> org.eclipse.jetty.server.session         : DefaultSessionIdManager
> workerName=node0
> 2021-02-17 14:55:03.045  INFO 50399 --- [           main]
> org.eclipse.jetty.server.session         : No SessionScavenger set, using
> defaults
> 2021-02-17 14:55:03.046  INFO 50399 --- [           main]
> org.eclipse.jetty.server.session         : node0 Scavenging every 660000ms
> 2021-02-17 14:55:03.099  INFO 50399 --- [           main]
> o.e.j.s.h.ContextHandler.gemfire_api     : Initializing Spring
> DispatcherServlet 'geode'
> 2021-02-17 14:55:03.099  INFO 50399 --- [           main]
> o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'geode'
>
>
> I made modifications to the entire example app, again here
> <https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi> [4].
> I added
> <https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L44-L67> [5]
> the geode-web-api WAR as a runtime dependency to my application
> classpath, enabled with a Maven Profile.
>
> To run the *Spring Boot*, Apache Geode server application
> <https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java> [6]
> with the Developer REST API enabled
> <https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L98> [7],
> I ran the following mvn command
> <https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-geode-web-api-profile.bsh#L3>.
> [8] Because the geode-web-api WAR is on the appliation classpath, 1) I do
> *not* need to download/install an Apache Geode distribution (e.g.
> 1.12.0), 2) *nor* do I need to set the GEODE_HOME environment variable or
> alternatively the 'gemfire.home' System property. Convenient!
>
> Compare and contrast this mvn​ command [8] with the installation/System
> property configuration mvn​ command
> <https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-gemfire-home.bsh#L3> [9]
> and approach.
>
> However, using the classpath approach, you do give up a degree of control
> over the WAR file, which is leading to our problem in the first place
> (namely Swagger and the Java ClassLoader issue caused by duplication of the
> *Spring*/Jackson bits on the parent & child ClassLoader classpaths).
>
> You run into this Exception...
>
> 2021-02-17 14:55:04.491  WARN 50399 --- [           main]
> org.eclipse.jetty.webapp.WebAppContext   : Failed startup of context
> o.e.j.w.WebAppContext@3a5e2525{GemFire Developer REST
> API,/geode,[file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/,
> jar:file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/WEB-INF/lib/springfox-swagger-ui-2.9.2.jar!/META-INF/resources],UNAVAILABLE}{/Users/jblum/.m2/repository/org/apache/geode/geode-web-api/1.13.1/geode-web-api-1.13.1.war}
>
> javax.servlet.ServletException:
> geode==org.springframework.web.servlet.DispatcherServlet@5db0b92
> {jsp=null,order=1,inst=true,async=true,src=DESCRIPTOR:file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/WEB-INF/web.xml}
>   at
> org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:642)
> ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120]
> ...
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
> Failed to process import candidates for configuration class
> [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested
> exception is java.lang.ClassCastException:
> org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> cannot be cast to org.springframework.context.annotation.Condition at
> org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:610)
> ~[spring-context-5.3.3.jar:5.3.3]
> ...
> Caused by: java.lang.ClassCastException:
> org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> cannot be cast to org.springframework.context.annotation.Condition
> ...
> ..
> .
>
>
> This ClassCastException is the root of the problem and stems from the
> Java ClassLoader issue I have (briefly) described throughout this email
> series.
>
> This ClassCastException is what led me to try and "disable" Swagger in
> the first place, especially since it is not required to run the Geode
> Developer REST API as I previously stated and demonstrated.
>
> But, with the classpath approach, how do you disable Swagger from being
> configured by the embedded *Spring Container* used to run the Geode
> Developer REST API. How do you avoid this ClassLoader conflict? Maven
> Exclusions don't work.
>
> Our current arrangement currently looks like this:
>
> JVM -> *Spring (Boot)* app -> Apache Geode (cache) -> Jetty (HTTP Server)
> -> *Spring WebApplicationContext* -> Geode Developer REST API
>
> It is easy when you have an Apache Geode distribution installed since you
> can physically/manually massage the WAR file. But, in the classpath
> approach, you are effectively left with a JVM Agent, AspectJ compile-time
> bytecode manipulation, Spring/AspectJ LTW, etc. I am not even sure if this
> would work.
>
> This is WHY I say having a Spring Profile to explicitly enable the Swagger
> UI in the Geode Developer REST API would be helpful!  Something like...
>
> *@Profile("enable-swagger")*
> @PropertySource({"classpath:swagger.properties"})
> @Configuration
> @EnableSwagger2
> @SuppressWarnings("unused")
> public class SwaggerConfig { ... }
>
> Then, it becomes a simple matter to include Swagger if needed (or if even
> possible, depending on your arrangement).  It's even be possible for the
> Geode engineering team to preserve the existing behavior of enabling
> Swagger by default (though, I don't reommend it!) by using the following
> Spring Profile...
>
> *@Profile("!disable-swagger")*
>
> Anyway...
>
> I don't really see away around this issue ATM.
>
> You have to 1) download/install an Apache Geode distribution, 2) modify
> the WAR (to disable Swagger) and 3) set the GEODE_HOME env var or
> 'gemfire.home' System property. Only this approach enables a Spring Boot
> app to bootstrap and configure an Apache Geode server with the Developer
> REST API.
>
> If I think of anything else, I'll let you know. But, for now, this is all
> I have.
>
> Regards,
> John
>
>
> [1]
> https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java#L91
> [2]
> https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L64
> [3]
> https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L130-L137
> [3]
> https://search.maven.org/artifact/org.apache.geode/geode-web-api/1.13.1/war
> [4]
> https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi
> [5]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L44-L67
> [6]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java
> [7]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L98
> [8]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-geode-web-api-profile.bsh#L3
> [9]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-gemfire-home.bsh#L3
>
> ------------------------------
> *From:* John Blum <jb...@vmware.com>
> *Sent:* Wednesday, February 17, 2021 12:38 PM
> *To:* user@geode.apache.org <us...@geode.apache.org>
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
> 1 last thing...
>
> SBDG 1.3.8.RELEASE is based on *Spring Boot* 2.3.8.RELEASE and *Spring
> Data for Apache Geode* (SDG) 2.3, which is itself based on Apache Geode
> 1.12.
>
> It is important that all the stars align (i.e. versions of both direct as
> well as transitive dependencies, like Jackson and Swagger) when running
> your application in the most reliable way.
>
> See here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot-data-geode%2Fwiki%2FSpring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix%23version-compatibility-matrix&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447802582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YN9zHB%2F62YTZ1fz41GXvdnS3pzNs%2FkfSjwkFqPSARrA%3D&reserved=0> [1] and
> here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot%2Fblob%2Fv2.3.8.RELEASE%2Fspring-boot-project%2Fspring-boot-dependencies%2Fbuild.gradle&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447802582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F2vvDkMYpkcdHx8yzuONqC6NXNSYoQD4rJlr%2BfBk6m8%3D&reserved=0> [2],
> for more details.
>
> Regards,
> John
>
> [1]
> https://github.com/spring-projects/spring-boot-data-geode/wiki/Spring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix#version-compatibility-matrix
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot-data-geode%2Fwiki%2FSpring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix%23version-compatibility-matrix&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447812577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rwXJ14%2F3Zg6LXuRZgBBK5YMrhFKEKu4WAXH35vf6x5A%3D&reserved=0>
> [2]
> https://github.com/spring-projects/spring-boot/blob/v2.3.8.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot%2Fblob%2Fv2.3.8.RELEASE%2Fspring-boot-project%2Fspring-boot-dependencies%2Fbuild.gradle&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447812577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QydyQLNMupmIOtb7iVPhVk5WD6PBHBzOYB3hu%2BhrO7M%3D&reserved=0>
>
>
> ------------------------------
> *From:* John Blum <jb...@vmware.com>
> *Sent:* Wednesday, February 17, 2021 12:29 PM
> *To:* user@geode.apache.org <us...@geode.apache.org>
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
> Hi Pratibha-
>
> A quick update...
>
> First, I apologize for the typos in my first 2 emails; it was quite late
> my time when I tried to figure out the problem you were having.
>
> Second, I tried a slightly different approach today to see if I could get
> the Developer REST API working along with the Swagger UI.
>
> In a nutshell, I tried to keep Swagger (UI) in play by *not* removing the
> Apache Geode internal SwaggerConfig class (this
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447822568%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DEUWBApj7jjjCQ%2BSCOu%2FqpL2Q8bZi9W54USOHMr9mlI%3D&reserved=0> [1])
> from the
> apache-geode-<version>/tools/Extensions/geode-web-api-<version>.war file
> and instead removed the core *Spring Framework* JAR files contained in
> WEB-INF/lib, thereby letting the application main/parent ('app')
> ClassLoader resolve and load the core *Spring Framework* classes.  That
> is, let the main ('app'), or "parent" ClassLoader resolve core *Spring
> Framework* classes while the "child" Jetty WebAppClassLoader resolves
> classes only required the embedded Webapps not used by the *Spring Boot*
> application, e.g. like Swagger.
>
> Since you are using *Spring Boot* to bootstrap and configure an Apache
> Geode server with the Developer REST API enabled, it would be best to let
> the main/parent ClassLoader do the loading for the core *Spring Framework*
> classes.
>
> Even though, Servlet Container ClassLoaders are child-first (to preserve
> Webapp isolation), they still delegate up to the parent. Of course, in the
> embedded Servlet Container case, I am not sure if that is the case since
> Java is parent-first (for security reasons); I sort of remember otherwise.
> Anyway...
>
> 1) I tried with both Apache Geode 1.13.1 as well as 1.12.0.
>
> 2) Which means I rolled back to *Spring Boot* 2.3.8.RELEASE, which is
> based on core *Spring Framework* 5.2 matching the version of *Spring*
> used by the Apache Geode Developer REST API. I also rolled back SBDG to
> 1.3.8.RELEASE, matching *Spring Boot* 2.3.
>
> 3) I ran rm -Rf `find WEB-INF/lib/ -name "spring-*-5.2.*.RELEASE.jar" |
> grep -v "spring-security"` to remove the core *Spring Framework* JARS
> from the (e.g.)
> apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war file,
> WEB-INF/lib dir.
>
> 4) I played around with setting the jackson-bom.version property in my
> application Maven POM, to match Apache Geode's Jackson version of
> 2.10.[1|0], as apparent in the WAR file as well as tried to match Jackson
> with the version expected by Springfox Swagger (see here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447832564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L4nEsufNKE3gmLwb8Y1LRZE3OvB4P54Y2nQdR7KAm4Q%3D&reserved=0>
>  [2]).
>
> 5) I even tried to remove Jackson from the geode-web-api-1.12.0.war file
> as well.
>
> I either got a NoClassDefFoundError/ClassNotFoundException on the Jackson
> ObjectMapper class (when removing Jackson from the WAR; #5) or this
> Exception when Jackson was present...
>
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name
> 'org.apache.geode.rest.internal.web.http.converter.CustomMappingJackson2HttpMessageConverter#0'
> defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Cannot
> resolve reference to bean 'objectMapper' while setting bean property
> 'objectMapper'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'objectMapper' defined in ServletContext resource
> [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested
> exception is org.springframework.beans.FatalBeanException: Unknown feature
> class: com.fasterxml.jackson.core.JsonParser$Feature
> ...
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'objectMapper' defined in ServletContext resource
> [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested
> exception is org.springframework.beans.FatalBeanException: Unknown feature
> class: com.fasterxml.jackson.core.JsonParser$Feature
> ...
> Caused by: org.springframework.beans.FatalBeanException: Unknown feature
> class: com.fasterxml.jackson.core.JsonParser$Feature
> ...
> ..
> .
>
> Currently, I am out of ideas, but Java's ClassLoader mechanism is
> apparently running interference here. Anyway, as I stated above, I wanted
> to share this information with you in case it gives you more ideas of
> things to try.
>
> Of course, if Swagger is not strictly required in your Use Case, then you
> can use the approach I outlined in my email below (also see here
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447832564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kf3ABMwCWbYtwF%2FhtBLmxLldSstoVcIYQ3TjBXZR1Ks%3D&reserved=0>
>  [3]).
>
> Ultimately, I think...
>
> 1) Swagger should not be enabled by default in Apache Geode when using the
> Developer REST API, and...
> 2) Using (enabling) Swagger with Apache Geode Developer REST API should be
> an opt-in feature (enabled with a Spring Profile), which would help to
> avoid the issue in this case.
>
> Good luck!
>
> Regards,
> John
>
> [1]
> https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447842559%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nb67qMt4QcqNLw9U4M7wC6myc37C%2BZWw96%2F%2BPL0aUB8%3D&reserved=0>
> [2]
> https://github.com/springfox/springfox/blob/2.9.2/gradle/dependencies.gradle#L9
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447842559%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SjcsfMcBfr%2FTXFbVNaFBOQfxupHJ%2Fkl4NFSrPtK6hhk%3D&reserved=0>
> [3] http://markmail.org/message/stpa4tl55qybpeo7
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447852557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6WyqDqSA0Ey5LgD4cL8x6BEfhMh9mP3rnTqNuKLrKww%3D&reserved=0>
>
> ------------------------------
> *From:* John Blum <jb...@vmware.com>
> *Sent:* Wednesday, February 17, 2021 2:29 AM
> *To:* user@geode.apache.org <us...@geode.apache.org>
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
> Slight correct to...
>
> 1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
>
> Which should have read...
>
> 1) jar -*x*vf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
>
> Sorry,
> John
>
> ------------------------------
> *From:* John Blum <jb...@vmware.com>
> *Sent:* Wednesday, February 17, 2021 2:18 AM
> *To:* user@geode.apache.org <us...@geode.apache.org>
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
> Hi Pratibha-
>
> I have tried to (loosely) cover this topic in the *Spring for Apache
> Geode* documentation:
>
> * See *Spring Data for Apache Geode* (SDG) docs here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447852557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9LQk9HWd2KUlbMKD%2BWV%2FG4d0%2Fanx0GlnfflcddvKm3o%3D&reserved=0>.
> [1]
>
> * See *Spring Boot for Apache Geode* (SBDG) docs here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447862548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=piduxL4LcqotWWNJSJWGX3V86PnwryjU2puYnzIh5Sw%3D&reserved=0> [2],
> and specifically, see the section titled, "*Additional Manager
> dependencies expressed in Gradle*".
>
> I built an example to show how to (partly) accomplish this Use Case (UC)
> here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447862548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yTYXsHRD30CBwy%2Bpnc7hRCqc5PxYynrRgYmGi5wSxrA%3D&reserved=0>.
> [3]
>
> To be clear about what the UC actually is, you want to use *Spring Boot* to
> bootstrap and configure an Apache Geode server running the Developer REST
> API
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447872540%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=b6lAQem4zfBPgLV0yzg%2B83FuCqHiQpURnph4hTaSK90%3D&reserved=0>.
> [4]
>
> To be able to run any of Apache Geode's provided Web applications [
> Developer REST API, Pulse, Management REST API], you must first enable
> the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP
> service to host the (aforementioned) Web applications provided in the
> Apache Geode distribution.
>
> It's rather trivial to start the embedded HTTP service. To do this:
>
> 1) Simply annotate your *Spring (Boot**)* application @Configuration with
> SDG's @EnableHttpService annotation and set the startDeveloperRestApi
> attribute to *true* (for example
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447882534%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ATCG4YJf60%2BhhGHuHwIseKHX5MHRHuICBVI9LWdZy0k%3D&reserved=0> [5]),
> then...
>
> 2)  Declare the 'org.apache.geode:geode-http-service' as a runtime
> dependency (for example
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447882534%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a%2BCD9VGz%2FDNP8riEGHbPJP%2BftnQe6wmT5L%2FHC4TQGn8%3D&reserved=0>
>  [6]) in your Maven POM or Gradle build file, and finally...
>
> NOTE: Despite the SBDG docs in [2], you don't actually need the '
> org.apache.geode:geode-web' dependency nor do you need to declare '
> org.springframework.boot:spring-boot-starter-jetty' since '
> geode-http-service' includes Jetty for you.
>
> 3) You must set the GEODE_HOME environment variable or alternatively, the
> "gemfire.home" System property to the absolute path of the Apache Geode
> distribution installed on your system.
>
> I have the Apache Geode 1.13.1 distribution installed at
> /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode
> (binaries & source) here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447892530%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=D2U%2B7po1iPx9oJheW0J%2BqBnAQpF8YnvQoew4cIE3wTs%3D&reserved=0>
>  [7].
>
> Setting the GEODE_HOME environment variable or the "gemfire.home" System
> property will be system dependent and also depend on how you launch your *Spring
> Boot*, Apache Geode server.
>
> For example, by using the *Spring Boot Maven Plugin
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447892530%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Cso66wuV9QDzQ56MnJuY2AsBRsWIcxnHraM0smJmGm0%3D&reserved=0>*:
> [8]
>
> $ mvn spring-boot:run
> -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"
>
> The Apache Geode Management REST API, Developer REST API & Pulse are all
> WAR files that are part of the Apache Geode distribution, so must tell
> Apache Geode where you install Apache Geode so it can find things.
>
> For example, the Developer REST API WAR file lives here:
>
> $ ls -la apache-geode-1.13.1/tools/Extensions/
> total 88528
> drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
> drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
> -rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
> -rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
> -rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27
> geode-web-management-1.13.1.war
>
> The Developer REST API is contained in the geode-web-api-1.13.1.war file. You
> can inspect the contents of the WAR by running the following command:
>
> $ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war |
> less
>
> Unfortunately, from here, running the Apache Geode Developer REST API from
> a Spring Boot initialized Apache Geode server was anything but trivial.
> And, as I suspect you discovered based on the title of your email, it has
> everything to do with Swagger. 😞
>
> It is rather naive that Apache Geode enables Swagger when
> enabling/starting the Developer REST API since:
>
> A) Swagger (while arguably convenient) is not needed to run the Developer
> REST API.
>
> B) There is no way to opt-out or disable Swagger if you don't want to run
> it, especially since....
>
> C) Neither Developer REST API nor Swagger are secure (HTTPS) by default
> and therefore poses a serious security risk, regardless if Geode is behind
> some firewall or (worse) not!
>
> Anyway! I suspect you hit this rather annoying Exception...
>
> org.springframework.beans.factory.BeanDefinitionStoreException: Failed to
> process import candidates for configuration class
> [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested
> exception is java.lang.ClassCastException: class
> org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> cannot be cast to class org.springframework.context.annotation.Condition
> (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> is in unnamed module of loader 'app';
> org.springframework.context.annotation.Condition is in unnamed module of
> loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
> ...
> ..
> .
> Caused by: java.lang.ClassCastException: class
> org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> cannot be cast to class org.springframework.context.annotation.Condition
> (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
> is in unnamed module of loader 'app';
> org.springframework.context.annotation.Condition is in unnamed module of
> loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
> ...
> ..
> .
>
> This Exception is not enough to prevent the Aapche Geode server from
> starting and running, but the Developer REST API will also NOT be
> available, either.
>
> No doubt, Swagger is causing ClassLoader issues, specifically between the
> child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the
> parent/main app ClassLoader used to boostrap the *Spring Boot*
> application (and eventually the Apache Geode CacheServer)! *Spring Boot's*
> o.s.b.a.c.OnWebApplicationCondition is very much a *Spring Framework*
> o.s.c.a.Condition!
>
> I worked around this issue by disabling Swagger!  However, this was the
> non-trivial part.
>
> Since Swagger does not provide a property or any other means to disable
> it, and Apache Geode did NOT provide an option to enable (opt-in; which
> should have been the default) or (rather) be able to disable (opt-out) the
> Swagger configuration (see here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447902523%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VFtbHGXVEt%2B%2BbLahHpbQmbE0rpV6mEWbcnIKvyiwQhk%3D&reserved=0> [9]),
> such as via a *Spring Profile* as it should have (!), then your only
> option is to rebuild the WAR file.
>
> I specifically (from a tmp directory)...
>
> 1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
> 2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
> 3) jar -cvf geode-web-api-1.13.1.war
> 4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions
>
> NOTE: It is probably a good idea to backup the original WAR file.
>
> The rm -Rf​ command in #2 above remove the
> o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures
> and initializes Swagger inthe first place, thereby effectively disabling
> Swagger.
>
> After dropping in the newly built WAR file, I can now run the Developer
> REST API from a *Spring Boot* bootstrapped and configured Apache Geode
> Server. \o/
>
> To make ensure everything worked, I put some test data into an Apache
> Geode, cache Region ("/Users"); see here
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447902523%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4%2FhAuIjBXcAkTaZ4cuw4lQAxE9KWdjzzDU6C6R5dzp8%3D&reserved=0>.
> [10]
>
> I verified this with *Gfsh*:
>
> $ gfsh
>     _________________________     __
>    / _____/ ______/ ______/ /____/ /
>   / /  __/ /___  /_____  / _____  /
>  / /__/ / ____/  _____/ / /    / /
> /______/_/      /______/_/    /_/    1.13.1
>
> Monitor and Manage Apache Geode
>
>
> gfsh>connect
> Connecting to Locator at [host=localhost, port=10334] ..
> Connecting to Manager at [host=10.99.199.24, port=1099] ..
> Successfully connected to: [host=10.99.199.24, port=1099]
>
> You are connected to a cluster of version: 1.13.1
>
>
> gfsh>list members
> Member Count : 1
>
>               Name                | Id
> --------------------------------- |
> ---------------------------------------------------------------------------------
> SpringBasedCacheServerApplication |
> 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
> [Coordinator]
>
> gfsh>describe member --name=SpringBasedCacheServerApplication
> Name        : SpringBasedCacheServerApplication
> Id          :
> 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
> Host        : 10.99.199.24
> Regions     : Users
> PID         : 46385
> Groups      :
> Used Heap   : 366M
> Max Heap    : 3641M
> Working Dir :
> /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
> Log file    :
> /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
> Locators    : localhost[10334]
>
> Cache Server Information
> Server Bind              :
> Server Port              : 40404
> Running                  : true
>
> Client Connections : 0
>
>
> gfsh>list regions
> List of regions
> ---------------
> Users
>
>
> gfsh>describe region --name=/Users
> Name            : Users
> Data Policy     : partition
> Hosting Members : SpringBasedCacheServerApplication
>
> Non-Default Attributes Shared By Hosting Members
>
>  Type  |    Name     | Value
> ------ | ----------- | ---------
> Region | size        | 2
>        | data-policy | PARTITION
>
>
> gfsh>query --query="SELECT u FROM /Users u"
> Result : true
> Limit  : 100
> Rows   : 2
>
> id | name
> -- | ---------
> 1  | "jonDoe"
> 2  | "janeDoe"
>
>
> Finally, I ran curl against the /Users Region
>
> $ curl http://localhost:7070/geode/v1/Users
> {
>   "Users" : [ {
>     "id" : 1,
>     "name" : "jonDoe"
>   }, {
>     "id" : 2,
>     "name" : "janeDoe"
>   } ]
>
> Which is proof that the Developer REST API is running!
>
> Hope this helps!
>
> Regards,
> John
>
>
> [1]
> https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447912518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=f4twIhWyhYS2gKE3BtblrNochmbOjqjqBUY0dYsTamw%3D&reserved=0>
> [2]
> https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447922513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cN6GwVwLXmo%2BYzrULgVf7kpMk0VWHbmYDNsU7TDUi%2FM%3D&reserved=0>
> [3]
> https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447922513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=m5AdTlBmvpel3K2FSAxMiCIHggj140rD1H%2FqLcAfzrM%3D&reserved=0>
> [4]
> https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447932506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=W409p9jVG%2F1hNoTwT3r4ME6%2F7PXqLdsTDwNsnviftJs%3D&reserved=0>
> [5]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447932506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4d8821DvqUHzysRmCsHXBXwIqTgSy095EbAxZrzDvME%3D&reserved=0>
> [6]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447942504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IxviCSiiONfnBxgi7nEa%2BjeD7bTRVMNjjkJEfQ%2Fdcxs%3D&reserved=0>
> [7] https://geode.apache.org/releases/
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447942504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BRNib2N1oi2IkP%2F9FRSh2pfpqb%2FvXEXMXDwaKYj0InQ%3D&reserved=0>
> [8]
> https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447952495%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7Ri0u0SIOuV6Qgg%2Bcb9mFA4W4sfzj2%2FoCIHu8YRbuM0%3D&reserved=0>
> [9]
> https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447962490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2Fo6tAJJMKd1vsg976dO%2FL6m57gzYccSdiOmUFD9Q23E%3D&reserved=0>
> [10]
> https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447962490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F9ZL7Pr%2Fk3osOGucXppglTt1K4G%2FoNO%2F8ClKncaabxc%3D&reserved=0>
>
>
> ------------------------------
> *From:* Pratibha Ayengar <pr...@gmail.com>
> *Sent:* Tuesday, February 16, 2021 8:52 PM
> *To:* user@geode.apache.org <us...@geode.apache.org>
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
> Hi Jens,
>
> Thank you for coming back. I do have the configurations in my spring xml
> file as follows. Starting the server from gfsh works fine. However, from a
> spring boot app (2.3.0.RELEASE) with these configurations tries to start
> the API then fails with these lines in the log. I have also
> tried @EnableHttpService
>
> 2021-02-17 10:18:51.016  INFO 11756 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
> 2021-02-17 10:18:51.017  INFO 11756 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-17 10:18:51.018  WARN 11756 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>     <util:properties id="geodeProperties">
>         <prop key="name">${SERVER_NAME}</prop>
>         <prop key="mcast-port">0</prop>
>         <prop key="locators">${LOCATORS}</prop>
>         <prop key="jmx-manager">false</prop>
>         <prop key="jmx-manager-start">false</prop>
>         <prop key="http-service-bind-address">localhost</prop>
>         <prop key="http-service-port">9301</prop>
>         <prop key="http-service-ssl-require-authentication">false</prop>
>         <prop key="start-dev-rest-api">true</prop>
>         <prop key="enable-network-partition-detection">false</prop>
>         <prop key="groups">default</prop>
>     </util:properties>
>
>     <geode:cache id="geodeCache"
>                  properties-ref="geodeProperties"
>                  pdx-serializer-ref="pdxSerializer"
>                  enable-auto-reconnect="true"
>                  critical-heap-percentage="90"
>                  eviction-heap-percentage="80"
>                  use-cluster-configuration="true"/>
>
>
>
> This is what my pom looks like. Do you see any missing dependency here?
>
> <project xmlns="http://maven.apache.org/POM/4.0.0
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447972484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=X7HWTjbN%2B%2F2bsjyTcxg0bBcvQhzs6nP62DtEODQSleo%3D&reserved=0>"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447972484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DIQrxjlMS%2BH%2Fronj0cxoKdSZiufwL7XXmP%2BZFpQVrq8%3D&reserved=0>"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447982482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Xz84Md5Zdd8NJtAwrE3%2BgKhMo7ftZVILRyKsRE2%2BFGc%3D&reserved=0>
> https://maven.apache.org/xsd/maven-4.0.0.xsd
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447982482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YHV8lZ2fXefo9mdL4CorMLzNEQgQvzHC35aZBflWCZg%3D&reserved=0>
> ">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>com.example</groupId>
>   <artifactId>geode-server</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>   <name>GeodeServer</name>
>
>   <properties>
>         <maven.compiler.source>8</maven.compiler.source>
>         <maven.compiler.target>8</maven.compiler.target>
>     </properties>
>
>     <parent>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-starter-parent</artifactId>
>         <version>2.3.0.RELEASE</version>
>     </parent>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-jetty</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.data</groupId>
>             <artifactId>spring-data-geode</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.shell</groupId>
>             <artifactId>spring-shell</artifactId>
>             <version>1.2.0.RELEASE</version>
>         </dependency>
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>log4j-over-slf4j</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-core</artifactId>
>         </dependency>
>
>     </dependencies>
>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.springframework.boot</groupId>
>                 <artifactId>spring-boot-maven-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>repackage</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
>     </build>
> </project>
>
>
> Thanks,
> Pratibha
>
> On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com> wrote:
>
> Hi Pratibha,
>
>
>
> In order to start the Developer REST API (which also exposes the Swagger
> UI) you must set the following properties when you start the server:
>
>
>
> start-dev-rest-api=true
>
>
>
> In order to do this from gfsh you should use the following option:
> --J=-Dgemfire.start-dev-rest-api=true. Or if you have a
> gemfire.properties file then just add the property (without the “gemfire.”
> prefix). In the server log you should see the following lines indicating
> the correct startup of the Dev REST API:
>
>
>
> [info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1]
> GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode
>
>
>
> [info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war:
> geode-web-api at location:
> file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war
>
>
>
> [info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp
> /gemfire-api
>
>
>
> [info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] *Attempting to
> start HTTP service on port (7171) at bind-address (0.0.0.0)...*
>
>
>
> [info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing
> Servlet 'geode'
>
>
>
> [info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean
> 'util:constant#45dc7be' of type
> [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is
> not eligible for getting processed by all BeanPostProcessors (for example:
> not eligible for auto-proxying)
>
>
>
> In the above example I had also set: --J=-Dgemfire.http-service-port=7171
> (the default is normally 7070).
>
>
>
> Also, the Swagger UI is only available from servers and is not available
> on the locator.
>
>
>
> Hope this helps.
>
> --Jens
>
>
>
> *From: *Pratibha Ayengar <pr...@gmail.com>
> *Reply-To: *"user@geode.apache.org" <us...@geode.apache.org>
> *Date: *Monday, February 15, 2021 at 8:52 PM
> *To: *"user@geode.apache.org" <us...@geode.apache.org>
> *Subject: *Re: Apache geode 1.12.0 swagger UI issue
>
>
>
> Thank you, Rupert. This does help narrow it down. Would you be able to
> help on what this particular check is - if (cache.getOptionalService(
> HttpService.class).isPresent())
>
> This is the one that seems to be failing.
>
>
>
> Thanks,
>
> Pratibha
>
>
>
>
>
> On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <
> rupert.stjohnwebster@impress-solutions.com> wrote:
>
> // Check if we're already running inside Tomcat
>
>         if (isRunningInTomcat()) {
>
>             logger.warn("Detected presence of catalina system properties.
> HTTP service will not be started. To enable the GemFire Developer REST API,
> please deploy the /geode-web-api WAR file in your application server.");
>
>         } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
>
>             Map<String, Object> securityServiceAttr = new HashMap<>();
>
>             securityServiceAttr.put(HttpService.
> SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
>
>             if (cache.getOptionalService(HttpService.class).isPresent()) {
>
>                 HttpService httpService = cache.getOptionalService(
> HttpService.class).get();
>
>                 Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
>
>                 httpService.addWebApplication("/gemfire-api",
> gemfireAPIWarPath, securityServiceAttr);
>
>                 httpService.addWebApplication("/geode", gemfireAPIWarPath,
> securityServiceAttr);
>
>             } else {
>
>                 logger.warn("HttpService is not available - could not
> start Dev REST API");
>
>             }
>
>
>
> Is this any help?
>
>
>
> cheers
>
>
>
> *From:* Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
> *Sent:* 14 February 2021 09:44
> *To:* user@geode.apache.org
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
>
>
> *This email has reached the company via an external source. *
>
> *Please be cautious opening any attachments or links. *
>
>
> Hi Aashish,
>
>
>
> Thank you for coming back. I got the same result after setting GEODE_HOME.
> Here are the logs. Any idea what could cause this issue?
>
>
>
> 2021-02-14 15:12:31.426  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
> 2021-02-14 15:12:31.428  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-14 15:12:31.429  WARN 9976 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Thanks,
>
> Pratibha
>
>
>
> On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <
> aashish.choudhary1@gmail.com> wrote:
>
> For some reason your GEODE_HOME is null and it might be causing this
> issue. Please check that first.
>
> With best regards,
> Ashish
>
>
>
> On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>
> wrote:
>
>
>
> Hi Geode Team,
>
>
>
> I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
> and I am having trouble starting up the REST API. Could you please help me
> understand what I am missing here.
>
>
>
> We start up the locator using gfsh and use a spring data geode project to
> start the server. Attached are the geode.properties file used to start the
> locator and the project used to start the server.
>
>
>
> Following are the commands and the JVM arguments used for the locator and
> server respectively. I have also attached the logs from the server that
> does not seem to indicate the reason why the swagger API is not started.
>
>
>
> SpringBoot version - 2.3.0.RELEASE
>
>
>
> Locator start command
>
> start locator --name=Locator1 --port=10334
> --properties-file=D:\apache-geode-1.12.0\geode-locator.properties
>
>
>
> JVM arguments used while starting server
>
> -Dgemfire.home=D:\apache-geode-1.12.0
>
>
>
> Line in the logs that show the API is not available -
>
> 2021-02-04 10:53:05.983  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-04 10:53:05.984  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> D:\apache-geode-1.12.0
> 2021-02-04 10:53:05.985  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-04 10:53:05.986  WARN 8936 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Appreciate any help I can get.
>
>
>
> Thank you,
>
> Pratibha Ayengar
>
>
>
>

Re: Apache geode 1.12.0 swagger UI issue

Posted by John Blum <jb...@vmware.com>.
Hi Pratibha-

I cannot seem to put your problem down... :P

Sometime ago, the Apache Geode core engineering team (compliments of Udo Kohlmeyer, Committer/PMC member) made a fine modification to Geode to load the Geode Webapps from the classpath (effectively here<https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java#L91> [1], then here<https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L64> [2], and finally, here<https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L130-L137> [3]), rather than requiring an installation of an Apache Geode distribution (e.g. 1.12.0) on your system.

NOTE: These Apache Geode code references are similar to where Rupert was pointing you earlier.

Additionally, Geode WAR files are published to Maven Central along with the other module Geode JARs (e.g. geode-core), for example<https://search.maven.org/artifact/org.apache.geode/geode-web-api/1.13.1/war> [3], the geode-web-api WAR file for the Developer REST API.

I was aware of this approach and tried this before I even responded to you the first time, but I ran into some problem I don't recall now and quickly switched directions. I wanted revisit this approach as I think it's a nice alternative to having to download and install Apache Geode locally. I even use this approach for some of the Integration Tests in the SDG and SBDG test suites to test certain features and functions.

I got the classpath approach to work, but there are limitations and ever persistent problems (yet), again caused by Swagger. 😞 You can see that the HTTP service started in the log output:

2021-02-17 14:55:01.322  INFO 50399 --- [           main] o.a.g.i.cache.InternalHttpService        : Enabled InternalHttpService on port 7070
2021-02-17 14:55:01.322  INFO 50399 --- [           main] o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service org.apache.geode.internal.cache.InternalHttpService
2021-02-17 14:55:01.367  INFO 50399 --- [           main] o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service org.apache.geode.cache.lucene.internal.LuceneServiceImpl
2021-02-17 14:55:02.226  INFO 50399 --- [           main] o.a.g.internal.cache.GemFireCacheImpl    : Initialized cache service org.apache.geode.management.internal.cli.remote.OnlineCommandProcessor
2021-02-17 14:55:02.263  INFO 50399 --- [           main] o.a.g.internal.cache.DistributedRegion   : Initializing region _monitoringRegion_10.99.199.24<v0>41000
2021-02-17 14:55:02.265  INFO 50399 --- [           main] o.a.g.internal.cache.DistributedRegion   : Initialization of region _monitoringRegion_10.99.199.24<v0>41000 completed
2021-02-17 14:55:02.310  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-17 14:55:02.310  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> null
2021-02-17 14:55:02.310  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME environment variable not set; HTTP service will not start.
2021-02-17 14:55:02.311  WARN 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : geode-web war file was not found
2021-02-17 14:55:02.311  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-17 14:55:02.311  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> null
2021-02-17 14:55:02.312  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME environment variable not set; HTTP service will not start.
2021-02-17 14:55:02.312  WARN 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : geode-pulse war file was not found
2021-02-17 14:55:02.342  INFO 50399 --- [           main] o.a.g.m.internal.ManagementAgent         : Registered AccessControlMBean on GemFire:service=AccessControl,type=Distributed
2021-02-17 14:55:02.345  INFO 50399 --- [           main] o.a.g.m.internal.ManagementAgent         : Registered FileUploaderMBean on GemFire:service=FileUploader,type=Distributed
2021-02-17 14:55:02.366  INFO 50399 --- [           main] org.apache.geode.internal.JarDeployer    : Loading previously deployed jars
2021-02-17 14:55:02.371  INFO 50399 --- [           main] o.a.g.internal.cache.DistributedRegion   : Initializing region PdxTypes
2021-02-17 14:55:02.371  INFO 50399 --- [           main] o.a.g.internal.cache.DistributedRegion   : Initialization of region PdxTypes completed
2021-02-17 14:55:02.373  INFO 50399 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/Users/jblum/.m2/repository/org/apache/geode/geode-web-api/1.13.1/geode-web-api-1.13.1.war
2021-02-17 14:55:02.422  INFO 50399 --- [           main] o.a.g.i.cache.InternalHttpService        : Adding webapp /gemfire-api
2021-02-17 14:55:02.423  INFO 50399 --- [           main] o.a.g.i.cache.InternalHttpService        : Attempting to start HTTP service on port (7070) at bind-address (0.0.0.0)...
2021-02-17 14:55:02.424  INFO 50399 --- [           main] org.eclipse.jetty.server.Server          : jetty-9.4.35.v20201120; built: 2020-11-20T21:17:03.964Z; git: bdc54f03a5e0a7e280fab27f55c3c75ee8da89fb; jvm 1.8.0_241-b07
2021-02-17 14:55:03.033  INFO 50399 --- [           main] o.e.j.w.StandardDescriptorProcessor      : NO JSP Support for /gemfire-api, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-02-17 14:55:03.044  INFO 50399 --- [           main] org.eclipse.jetty.server.session         : DefaultSessionIdManager workerName=node0
2021-02-17 14:55:03.045  INFO 50399 --- [           main] org.eclipse.jetty.server.session         : No SessionScavenger set, using defaults
2021-02-17 14:55:03.046  INFO 50399 --- [           main] org.eclipse.jetty.server.session         : node0 Scavenging every 660000ms
2021-02-17 14:55:03.099  INFO 50399 --- [           main] o.e.j.s.h.ContextHandler.gemfire_api     : Initializing Spring DispatcherServlet 'geode'
2021-02-17 14:55:03.099  INFO 50399 --- [           main] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'geode'


I made modifications to the entire example app, again here<https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi> [4]. I added<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L44-L67> [5] the geode-web-api WAR as a runtime dependency to my application classpath, enabled with a Maven Profile.

To run the Spring Boot, Apache Geode server application<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java> [6] with the Developer REST API enabled<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L98> [7], I ran the following mvn command<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-geode-web-api-profile.bsh#L3>. [8] Because the geode-web-api WAR is on the appliation classpath, 1) I do not need to download/install an Apache Geode distribution (e.g. 1.12.0), 2) nor do I need to set the GEODE_HOME environment variable or alternatively the 'gemfire.home' System property. Convenient!

Compare and contrast this mvn​ command [8] with the installation/System property configuration mvn​ command<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-gemfire-home.bsh#L3> [9] and approach.

However, using the classpath approach, you do give up a degree of control over the WAR file, which is leading to our problem in the first place (namely Swagger and the Java ClassLoader issue caused by duplication of the Spring/Jackson bits on the parent & child ClassLoader classpaths).

You run into this Exception...

2021-02-17 14:55:04.491  WARN 50399 --- [           main] org.eclipse.jetty.webapp.WebAppContext   : Failed startup of context o.e.j.w.WebAppContext@3a5e2525{GemFire Developer REST API,/geode,[file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/, jar:file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/WEB-INF/lib/springfox-swagger-ui-2.9.2.jar!/META-INF/resources],UNAVAILABLE}{/Users/jblum/.m2/repository/org/apache/geode/geode-web-api/1.13.1/geode-web-api-1.13.1.war}

javax.servlet.ServletException: geode==org.springframework.web.servlet.DispatcherServlet@5db0b92{jsp=null,order=1,inst=true,async=true,src=DESCRIPTOR:file:///Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi/GemFire_jblum/services/http/0.0.0.0_7070_geode_1153deb5/webapp/WEB-INF/web.xml}
  at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:642) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120]
...
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to org.springframework.context.annotation.Condition at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:610) ~[spring-context-5.3.3.jar:5.3.3]
...
Caused by: java.lang.ClassCastException: org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to org.springframework.context.annotation.Condition
...
..
.


This ClassCastException is the root of the problem and stems from the Java ClassLoader issue I have (briefly) described throughout this email series.

This ClassCastException is what led me to try and "disable" Swagger in the first place, especially since it is not required to run the Geode Developer REST API as I previously stated and demonstrated.

But, with the classpath approach, how do you disable Swagger from being configured by the embedded Spring Container used to run the Geode Developer REST API. How do you avoid this ClassLoader conflict? Maven Exclusions don't work.

Our current arrangement currently looks like this:

JVM -> Spring (Boot) app -> Apache Geode (cache) -> Jetty (HTTP Server) -> Spring WebApplicationContext -> Geode Developer REST API

It is easy when you have an Apache Geode distribution installed since you can physically/manually massage the WAR file. But, in the classpath approach, you are effectively left with a JVM Agent, AspectJ compile-time bytecode manipulation, Spring/AspectJ LTW, etc. I am not even sure if this would work.

This is WHY I say having a Spring Profile to explicitly enable the Swagger UI in the Geode Developer REST API would be helpful!  Something like...

@Profile("enable-swagger")
@PropertySource({"classpath:swagger.properties"})
@Configuration
@EnableSwagger2
@SuppressWarnings("unused")
public class SwaggerConfig { ... }

Then, it becomes a simple matter to include Swagger if needed (or if even possible, depending on your arrangement).  It's even be possible for the Geode engineering team to preserve the existing behavior of enabling Swagger by default (though, I don't reommend it!) by using the following Spring Profile...

@Profile("!disable-swagger")

Anyway...

I don't really see away around this issue ATM.

You have to 1) download/install an Apache Geode distribution, 2) modify the WAR (to disable Swagger) and 3) set the GEODE_HOME env var or 'gemfire.home' System property. Only this approach enables a Spring Boot app to bootstrap and configure an Apache Geode server with the Developer REST API.

If I think of anything else, I'll let you know. But, for now, this is all I have.

Regards,
John


[1] https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java#L91
[2] https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L64
[3] https://github.com/apache/geode/blob/rel/v1.13.1/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java#L130-L137
[3] https://search.maven.org/artifact/org.apache.geode/geode-web-api/1.13.1/war
[4] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L44-L67
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java
[7] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L98
[8] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-geode-web-api-profile.bsh#L3
[9] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/bin/boot-run-with-gemfire-home.bsh#L3

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 12:38 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

1 last thing...

SBDG 1.3.8.RELEASE is based on Spring Boot 2.3.8.RELEASE and Spring Data for Apache Geode (SDG) 2.3, which is itself based on Apache Geode 1.12.

It is important that all the stars align (i.e. versions of both direct as well as transitive dependencies, like Jackson and Swagger) when running your application in the most reliable way.

See here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot-data-geode%2Fwiki%2FSpring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix%23version-compatibility-matrix&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447802582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YN9zHB%2F62YTZ1fz41GXvdnS3pzNs%2FkfSjwkFqPSARrA%3D&reserved=0> [1] and here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot%2Fblob%2Fv2.3.8.RELEASE%2Fspring-boot-project%2Fspring-boot-dependencies%2Fbuild.gradle&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447802582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F2vvDkMYpkcdHx8yzuONqC6NXNSYoQD4rJlr%2BfBk6m8%3D&reserved=0> [2], for more details.

Regards,
John

[1] https://github.com/spring-projects/spring-boot-data-geode/wiki/Spring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix#version-compatibility-matrix<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot-data-geode%2Fwiki%2FSpring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix%23version-compatibility-matrix&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447812577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rwXJ14%2F3Zg6LXuRZgBBK5YMrhFKEKu4WAXH35vf6x5A%3D&reserved=0>
[2] https://github.com/spring-projects/spring-boot/blob/v2.3.8.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-boot%2Fblob%2Fv2.3.8.RELEASE%2Fspring-boot-project%2Fspring-boot-dependencies%2Fbuild.gradle&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447812577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QydyQLNMupmIOtb7iVPhVk5WD6PBHBzOYB3hu%2BhrO7M%3D&reserved=0>


________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 12:29 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

A quick update...

First, I apologize for the typos in my first 2 emails; it was quite late my time when I tried to figure out the problem you were having.

Second, I tried a slightly different approach today to see if I could get the Developer REST API working along with the Swagger UI.

In a nutshell, I tried to keep Swagger (UI) in play by not removing the Apache Geode internal SwaggerConfig class (this<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447822568%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DEUWBApj7jjjCQ%2BSCOu%2FqpL2Q8bZi9W54USOHMr9mlI%3D&reserved=0> [1]) from the apache-geode-<version>/tools/Extensions/geode-web-api-<version>.war file and instead removed the core Spring Framework JAR files contained in WEB-INF/lib, thereby letting the application main/parent ('app') ClassLoader resolve and load the core Spring Framework classes.  That is, let the main ('app'), or "parent" ClassLoader resolve core Spring Framework classes while the "child" Jetty WebAppClassLoader resolves classes only required the embedded Webapps not used by the Spring Boot application, e.g. like Swagger.

Since you are using Spring Boot to bootstrap and configure an Apache Geode server with the Developer REST API enabled, it would be best to let the main/parent ClassLoader do the loading for the core Spring Framework classes.

Even though, Servlet Container ClassLoaders are child-first (to preserve Webapp isolation), they still delegate up to the parent. Of course, in the embedded Servlet Container case, I am not sure if that is the case since Java is parent-first (for security reasons); I sort of remember otherwise.  Anyway...

1) I tried with both Apache Geode 1.13.1 as well as 1.12.0.

2) Which means I rolled back to Spring Boot 2.3.8.RELEASE, which is based on core Spring Framework 5.2 matching the version of Spring used by the Apache Geode Developer REST API. I also rolled back SBDG to 1.3.8.RELEASE, matching Spring Boot 2.3.

3) I ran rm -Rf `find WEB-INF/lib/ -name "spring-*-5.2.*.RELEASE.jar" | grep -v "spring-security"` to remove the core Spring Framework JARS from the (e.g.) apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war file, WEB-INF/lib dir.

4) I played around with setting the jackson-bom.version property in my application Maven POM, to match Apache Geode's Jackson version of 2.10.[1|0], as apparent in the WAR file as well as tried to match Jackson with the version expected by Springfox Swagger (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447832564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L4nEsufNKE3gmLwb8Y1LRZE3OvB4P54Y2nQdR7KAm4Q%3D&reserved=0> [2]).

5) I even tried to remove Jackson from the geode-web-api-1.12.0.war file as well.

I either got a NoClassDefFoundError/ClassNotFoundException on the Jackson ObjectMapper class (when removing Jackson from the WAR; #5) or this Exception when Jackson was present...

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.geode.rest.internal.web.http.converter.CustomMappingJackson2HttpMessageConverter#0' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Cannot resolve reference to bean 'objectMapper' while setting bean property 'objectMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
..
.

Currently, I am out of ideas, but Java's ClassLoader mechanism is apparently running interference here. Anyway, as I stated above, I wanted to share this information with you in case it gives you more ideas of things to try.

Of course, if Swagger is not strictly required in your Use Case, then you can use the approach I outlined in my email below (also see here<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447832564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kf3ABMwCWbYtwF%2FhtBLmxLldSstoVcIYQ3TjBXZR1Ks%3D&reserved=0> [3]).

Ultimately, I think...

1) Swagger should not be enabled by default in Apache Geode when using the Developer REST API, and...
2) Using (enabling) Swagger with Apache Geode Developer REST API should be an opt-in feature (enabled with a Spring Profile), which would help to avoid the issue in this case.

Good luck!

Regards,
John

[1] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447842559%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nb67qMt4QcqNLw9U4M7wC6myc37C%2BZWw96%2F%2BPL0aUB8%3D&reserved=0>
[2] https://github.com/springfox/springfox/blob/2.9.2/gradle/dependencies.gradle#L9<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447842559%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SjcsfMcBfr%2FTXFbVNaFBOQfxupHJ%2Fkl4NFSrPtK6hhk%3D&reserved=0>
[3] http://markmail.org/message/stpa4tl55qybpeo7<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447852557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6WyqDqSA0Ey5LgD4cL8x6BEfhMh9mP3rnTqNuKLrKww%3D&reserved=0>

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:29 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Slight correct to...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Which should have read...

1) jar -xvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Sorry,
John

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:18 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

I have tried to (loosely) cover this topic in the Spring for Apache Geode documentation:

* See Spring Data for Apache Geode (SDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447852557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9LQk9HWd2KUlbMKD%2BWV%2FG4d0%2Fanx0GlnfflcddvKm3o%3D&reserved=0>. [1]

* See Spring Boot for Apache Geode (SBDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447862548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=piduxL4LcqotWWNJSJWGX3V86PnwryjU2puYnzIh5Sw%3D&reserved=0> [2], and specifically, see the section titled, "Additional Manager dependencies expressed in Gradle".

I built an example to show how to (partly) accomplish this Use Case (UC) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447862548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yTYXsHRD30CBwy%2Bpnc7hRCqc5PxYynrRgYmGi5wSxrA%3D&reserved=0>. [3]

To be clear about what the UC actually is, you want to use Spring Boot to bootstrap and configure an Apache Geode server running the Developer REST API<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447872540%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=b6lAQem4zfBPgLV0yzg%2B83FuCqHiQpURnph4hTaSK90%3D&reserved=0>. [4]

To be able to run any of Apache Geode's provided Web applications [Developer REST API, Pulse, Management REST API], you must first enable the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP service to host the (aforementioned) Web applications provided in the Apache Geode distribution.

It's rather trivial to start the embedded HTTP service. To do this:

1) Simply annotate your Spring (Boot) application @Configuration with SDG's @EnableHttpService annotation and set the startDeveloperRestApi attribute to true (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447882534%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ATCG4YJf60%2BhhGHuHwIseKHX5MHRHuICBVI9LWdZy0k%3D&reserved=0> [5]), then...

2)  Declare the 'org.apache.geode:geode-http-service' as a runtime dependency (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447882534%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a%2BCD9VGz%2FDNP8riEGHbPJP%2BftnQe6wmT5L%2FHC4TQGn8%3D&reserved=0> [6]) in your Maven POM or Gradle build file, and finally...

NOTE: Despite the SBDG docs in [2], you don't actually need the 'org.apache.geode:geode-web' dependency nor do you need to declare 'org.springframework.boot:spring-boot-starter-jetty' since 'geode-http-service' includes Jetty for you.

3) You must set the GEODE_HOME environment variable or alternatively, the "gemfire.home" System property to the absolute path of the Apache Geode distribution installed on your system.

I have the Apache Geode 1.13.1 distribution installed at  /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode (binaries & source) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447892530%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=D2U%2B7po1iPx9oJheW0J%2BqBnAQpF8YnvQoew4cIE3wTs%3D&reserved=0> [7].

Setting the GEODE_HOME environment variable or the "gemfire.home" System property will be system dependent and also depend on how you launch your Spring Boot, Apache Geode server.

For example, by using the Spring Boot Maven Plugin<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447892530%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Cso66wuV9QDzQ56MnJuY2AsBRsWIcxnHraM0smJmGm0%3D&reserved=0>: [8]

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"

The Apache Geode Management REST API, Developer REST API & Pulse are all WAR files that are part of the Apache Geode distribution, so must tell Apache Geode where you install Apache Geode so it can find things.

For example, the Developer REST API WAR file lives here:

$ ls -la apache-geode-1.13.1/tools/Extensions/
total 88528
drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
-rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27 geode-web-management-1.13.1.war

The Developer REST API is contained in the geode-web-api-1.13.1.war file. You can inspect the contents of the WAR by running the following command:

$ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war | less

Unfortunately, from here, running the Apache Geode Developer REST API from a Spring Boot initialized Apache Geode server was anything but trivial. And, as I suspect you discovered based on the title of your email, it has everything to do with Swagger. 😞

It is rather naive that Apache Geode enables Swagger when enabling/starting the Developer REST API since:

A) Swagger (while arguably convenient) is not needed to run the Developer REST API.

B) There is no way to opt-out or disable Swagger if you don't want to run it, especially since....

C) Neither Developer REST API nor Swagger are secure (HTTPS) by default and therefore poses a serious security risk, regardless if Geode is behind some firewall or (worse) not!

Anyway! I suspect you hit this rather annoying Exception...

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.
Caused by: java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.

This Exception is not enough to prevent the Aapche Geode server from starting and running, but the Developer REST API will also NOT be available, either.

No doubt, Swagger is causing ClassLoader issues, specifically between the child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the parent/main app ClassLoader used to boostrap the Spring Boot application (and eventually the Apache Geode CacheServer)! Spring Boot's o.s.b.a.c.OnWebApplicationCondition is very much a Spring Framework o.s.c.a.Condition!

I worked around this issue by disabling Swagger!  However, this was the non-trivial part.

Since Swagger does not provide a property or any other means to disable it, and Apache Geode did NOT provide an option to enable (opt-in; which should have been the default) or (rather) be able to disable (opt-out) the Swagger configuration (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447902523%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VFtbHGXVEt%2B%2BbLahHpbQmbE0rpV6mEWbcnIKvyiwQhk%3D&reserved=0> [9]), such as via a Spring Profile as it should have (!), then your only option is to rebuild the WAR file.

I specifically (from a tmp directory)...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
3) jar -cvf geode-web-api-1.13.1.war
4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions

NOTE: It is probably a good idea to backup the original WAR file.

The rm -Rf​ command in #2 above remove the o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures and initializes Swagger inthe first place, thereby effectively disabling Swagger.

After dropping in the newly built WAR file, I can now run the Developer REST API from a Spring Boot bootstrapped and configured Apache Geode Server. \o/

To make ensure everything worked, I put some test data into an Apache Geode, cache Region ("/Users"); see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447902523%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4%2FhAuIjBXcAkTaZ4cuw4lQAxE9KWdjzzDU6C6R5dzp8%3D&reserved=0>. [10]

I verified this with Gfsh:

$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  /
 / /__/ / ____/  _____/ / /    / /
/______/_/      /______/_/    /_/    1.13.1

Monitor and Manage Apache Geode


gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.24, port=1099] ..
Successfully connected to: [host=10.99.199.24, port=1099]

You are connected to a cluster of version: 1.13.1


gfsh>list members
Member Count : 1

              Name                | Id
--------------------------------- | ---------------------------------------------------------------------------------
SpringBasedCacheServerApplication | 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000 [Coordinator]

gfsh>describe member --name=SpringBasedCacheServerApplication
Name        : SpringBasedCacheServerApplication
Id          : 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
Host        : 10.99.199.24
Regions     : Users
PID         : 46385
Groups      :
Used Heap   : 366M
Max Heap    : 3641M
Working Dir : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Log file    : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Locators    : localhost[10334]

Cache Server Information
Server Bind              :
Server Port              : 40404
Running                  : true

Client Connections : 0


gfsh>list regions
List of regions
---------------
Users


gfsh>describe region --name=/Users
Name            : Users
Data Policy     : partition
Hosting Members : SpringBasedCacheServerApplication

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 2
       | data-policy | PARTITION


gfsh>query --query="SELECT u FROM /Users u"
Result : true
Limit  : 100
Rows   : 2

id | name
-- | ---------
1  | "jonDoe"
2  | "janeDoe"


Finally, I ran curl against the /Users Region

$ curl http://localhost:7070/geode/v1/Users
{
  "Users" : [ {
    "id" : 1,
    "name" : "jonDoe"
  }, {
    "id" : 2,
    "name" : "janeDoe"
  } ]

Which is proof that the Developer REST API is running!

Hope this helps!

Regards,
John


[1] https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447912518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=f4twIhWyhYS2gKE3BtblrNochmbOjqjqBUY0dYsTamw%3D&reserved=0>
[2] https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447922513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cN6GwVwLXmo%2BYzrULgVf7kpMk0VWHbmYDNsU7TDUi%2FM%3D&reserved=0>
[3] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447922513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=m5AdTlBmvpel3K2FSAxMiCIHggj140rD1H%2FqLcAfzrM%3D&reserved=0>
[4] https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447932506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=W409p9jVG%2F1hNoTwT3r4ME6%2F7PXqLdsTDwNsnviftJs%3D&reserved=0>
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447932506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4d8821DvqUHzysRmCsHXBXwIqTgSy095EbAxZrzDvME%3D&reserved=0>
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447942504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IxviCSiiONfnBxgi7nEa%2BjeD7bTRVMNjjkJEfQ%2Fdcxs%3D&reserved=0>
[7] https://geode.apache.org/releases/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447942504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BRNib2N1oi2IkP%2F9FRSh2pfpqb%2FvXEXMXDwaKYj0InQ%3D&reserved=0>
[8] https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447952495%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7Ri0u0SIOuV6Qgg%2Bcb9mFA4W4sfzj2%2FoCIHu8YRbuM0%3D&reserved=0>
[9] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447962490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2Fo6tAJJMKd1vsg976dO%2FL6m57gzYccSdiOmUFD9Q23E%3D&reserved=0>
[10] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447962490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F9ZL7Pr%2Fk3osOGucXppglTt1K4G%2FoNO%2F8ClKncaabxc%3D&reserved=0>


________________________________
From: Pratibha Ayengar <pr...@gmail.com>
Sent: Tuesday, February 16, 2021 8:52 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447972484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=X7HWTjbN%2B%2F2bsjyTcxg0bBcvQhzs6nP62DtEODQSleo%3D&reserved=0>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447972484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DIQrxjlMS%2BH%2Fronj0cxoKdSZiufwL7XXmP%2BZFpQVrq8%3D&reserved=0>" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447982482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Xz84Md5Zdd8NJtAwrE3%2BgKhMo7ftZVILRyKsRE2%2BFGc%3D&reserved=0> https://maven.apache.org/xsd/maven-4.0.0.xsd<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7C64e7bac2a163435e5a1e08d8d3840ef6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491911447982482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YHV8lZ2fXefo9mdL4CorMLzNEQgQvzHC35aZBflWCZg%3D&reserved=0>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:

Hi Pratibha,



In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:



start-dev-rest-api=true



In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:



[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode



[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war



[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api



[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...



[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'



[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)



In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).



Also, the Swagger UI is only available from servers and is not available on the locator.



Hope this helps.

--Jens



From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue



Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())

This is the one that seems to be failing.



Thanks,

Pratibha





On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:

// Check if we're already running inside Tomcat

        if (isRunningInTomcat()) {

            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");

        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {

            Map<String, Object> securityServiceAttr = new HashMap<>();

            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);

            if (cache.getOptionalService(HttpService.class).isPresent()) {

                HttpService httpService = cache.getOptionalService(HttpService.class).get();

                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);

                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);

                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);

            } else {

                logger.warn("HttpService is not available - could not start Dev REST API");

            }



Is this any help?



cheers



From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue



This email has reached the company via an external source.

Please be cautious opening any attachments or links.


Hi Aashish,



Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?



2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Thanks,

Pratibha



On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:

For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.

With best regards,
Ashish



On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:



Hi Geode Team,



I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.



We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.



Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.



SpringBoot version - 2.3.0.RELEASE



Locator start command

start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties



JVM arguments used while starting server

-Dgemfire.home=D:\apache-geode-1.12.0



Line in the logs that show the API is not available -

2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Appreciate any help I can get.



Thank you,

Pratibha Ayengar



Re: Apache geode 1.12.0 swagger UI issue

Posted by John Blum <jb...@vmware.com>.
1 last thing...

SBDG 1.3.8.RELEASE is based on Spring Boot 2.3.8.RELEASE and Spring Data for Apache Geode (SDG) 2.3, which is itself based on Apache Geode 1.12.

It is important that all the stars align (i.e. versions of both direct as well as transitive dependencies, like Jackson and Swagger) when running your application in the most reliable way.

See here<https://github.com/spring-projects/spring-boot-data-geode/wiki/Spring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix#version-compatibility-matrix> [1] and here<https://github.com/spring-projects/spring-boot/blob/v2.3.8.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle> [2], for more details.

Regards,
John

[1] https://github.com/spring-projects/spring-boot-data-geode/wiki/Spring-Boot-for-Apache-Geode-and-Pivotal-GemFire-Version-Compatibility-Matrix#version-compatibility-matrix
[2] https://github.com/spring-projects/spring-boot/blob/v2.3.8.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle


________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 12:29 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

A quick update...

First, I apologize for the typos in my first 2 emails; it was quite late my time when I tried to figure out the problem you were having.

Second, I tried a slightly different approach today to see if I could get the Developer REST API working along with the Swagger UI.

In a nutshell, I tried to keep Swagger (UI) in play by not removing the Apache Geode internal SwaggerConfig class (this<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221440338%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kAHgUSb3o2Xn%2BvTyp85ISXqUSfH2j0T54OtblmcTuwE%3D&reserved=0> [1]) from the apache-geode-<version>/tools/Extensions/geode-web-api-<version>.war file and instead removed the core Spring Framework JAR files contained in WEB-INF/lib, thereby letting the application main/parent ('app') ClassLoader resolve and load the core Spring Framework classes.  That is, let the main ('app'), or "parent" ClassLoader resolve core Spring Framework classes while the "child" Jetty WebAppClassLoader resolves classes only required the embedded Webapps not used by the Spring Boot application, e.g. like Swagger.

Since you are using Spring Boot to bootstrap and configure an Apache Geode server with the Developer REST API enabled, it would be best to let the main/parent ClassLoader do the loading for the core Spring Framework classes.

Even though, Servlet Container ClassLoaders are child-first (to preserve Webapp isolation), they still delegate up to the parent. Of course, in the embedded Servlet Container case, I am not sure if that is the case since Java is parent-first (for security reasons); I sort of remember otherwise.  Anyway...

1) I tried with both Apache Geode 1.13.1 as well as 1.12.0.

2) Which means I rolled back to Spring Boot 2.3.8.RELEASE, which is based on core Spring Framework 5.2 matching the version of Spring used by the Apache Geode Developer REST API. I also rolled back SBDG to 1.3.8.RELEASE, matching Spring Boot 2.3.

3) I ran rm -Rf `find WEB-INF/lib/ -name "spring-*-5.2.*.RELEASE.jar" | grep -v "spring-security"` to remove the core Spring Framework JARS from the (e.g.) apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war file, WEB-INF/lib dir.

4) I played around with setting the jackson-bom.version property in my application Maven POM, to match Apache Geode's Jackson version of 2.10.[1|0], as apparent in the WAR file as well as tried to match Jackson with the version expected by Springfox Swagger (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221450334%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TfDtDVxaiKPgpSfmz942bzel2TlbTUTU3XkjhR%2FoFXg%3D&reserved=0> [2]).

5) I even tried to remove Jackson from the geode-web-api-1.12.0.war file as well.

I either got a NoClassDefFoundError/ClassNotFoundException on the Jackson ObjectMapper class (when removing Jackson from the WAR; #5) or this Exception when Jackson was present...

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.geode.rest.internal.web.http.converter.CustomMappingJackson2HttpMessageConverter#0' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Cannot resolve reference to bean 'objectMapper' while setting bean property 'objectMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
..
.

Currently, I am out of ideas, but Java's ClassLoader mechanism is apparently running interference here. Anyway, as I stated above, I wanted to share this information with you in case it gives you more ideas of things to try.

Of course, if Swagger is not strictly required in your Use Case, then you can use the approach I outlined in my email below (also see here<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221450334%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TU8wVJgHPwB0ykQpWzZjwqjmx075J65KTpZTbu7PN6w%3D&reserved=0> [3]).

Ultimately, I think...

1) Swagger should not be enabled by default in Apache Geode when using the Developer REST API, and...
2) Using (enabling) Swagger with Apache Geode Developer REST API should be an opt-in feature (enabled with a Spring Profile), which would help to avoid the issue in this case.

Good luck!

Regards,
John

[1] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221460331%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Esg9N962pitDVd%2FavbNuvtPbYjuU%2FraVoWf1%2BdZvYu4%3D&reserved=0>
[2] https://github.com/springfox/springfox/blob/2.9.2/gradle/dependencies.gradle#L9<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fspringfox%2Fspringfox%2Fblob%2F2.9.2%2Fgradle%2Fdependencies.gradle%23L9&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221460331%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CBHybR53LgvHwtjnE3KXcOxmZMfK66caC5y730WFmp4%3D&reserved=0>
[3] http://markmail.org/message/stpa4tl55qybpeo7<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fmessage%2Fstpa4tl55qybpeo7&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221470316%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=c%2FbtLlk1d1KCQBODc%2FAnuAgKgU4zvQN2%2F%2FOUbgVSVgM%3D&reserved=0>

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:29 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Slight correct to...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Which should have read...

1) jar -xvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Sorry,
John

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:18 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

I have tried to (loosely) cover this topic in the Spring for Apache Geode documentation:

* See Spring Data for Apache Geode (SDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221470316%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bof8WmNnLxa%2FT9lk4dm7wjWwydI6tsogBdQRWOdb%2Fow%3D&reserved=0>. [1]

* See Spring Boot for Apache Geode (SBDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221480312%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HIeog5PiyyqJ7d147W0ijuINfLTWytN3dbFZiGZudq4%3D&reserved=0> [2], and specifically, see the section titled, "Additional Manager dependencies expressed in Gradle".

I built an example to show how to (partly) accomplish this Use Case (UC) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221480312%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vouDAmyRufluMvlqaVchNBjDgxUUt7kz2gsKl6jeQ1k%3D&reserved=0>. [3]

To be clear about what the UC actually is, you want to use Spring Boot to bootstrap and configure an Apache Geode server running the Developer REST API<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221490312%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2B%2FrjtOwk4v3ayvBcRbSSAc2Rfr77DfD%2FuKhRhhEaEPI%3D&reserved=0>. [4]

To be able to run any of Apache Geode's provided Web applications [Developer REST API, Pulse, Management REST API], you must first enable the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP service to host the (aforementioned) Web applications provided in the Apache Geode distribution.

It's rather trivial to start the embedded HTTP service. To do this:

1) Simply annotate your Spring (Boot) application @Configuration with SDG's @EnableHttpService annotation and set the startDeveloperRestApi attribute to true (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221490312%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7t4Fst%2FqOK6kFhBu%2BxHAdm8KOnR0wiOPzDqlz4ro3ic%3D&reserved=0> [5]), then...

2)  Declare the 'org.apache.geode:geode-http-service' as a runtime dependency (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221500299%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=EvpqAv6qVzb1RqwlVs63h7m504pTbMk7RZEp7nW4MRs%3D&reserved=0> [6]) in your Maven POM or Gradle build file, and finally...

NOTE: Despite the SBDG docs in [2], you don't actually need the 'org.apache.geode:geode-web' dependency nor do you need to declare 'org.springframework.boot:spring-boot-starter-jetty' since 'geode-http-service' includes Jetty for you.

3) You must set the GEODE_HOME environment variable or alternatively, the "gemfire.home" System property to the absolute path of the Apache Geode distribution installed on your system.

I have the Apache Geode 1.13.1 distribution installed at  /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode (binaries & source) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221500299%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BCL4qBcLSivcwPsJPXHOeOvg7M2MWXxJKnkdd2%2BQ9cM%3D&reserved=0> [7].

Setting the GEODE_HOME environment variable or the "gemfire.home" System property will be system dependent and also depend on how you launch your Spring Boot, Apache Geode server.

For example, by using the Spring Boot Maven Plugin<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221510293%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KbPOdlWEMelq7wZEMiJxRwf1PqxXubLeHjS0fhNxAVY%3D&reserved=0>: [8]

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"

The Apache Geode Management REST API, Developer REST API & Pulse are all WAR files that are part of the Apache Geode distribution, so must tell Apache Geode where you install Apache Geode so it can find things.

For example, the Developer REST API WAR file lives here:

$ ls -la apache-geode-1.13.1/tools/Extensions/
total 88528
drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
-rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27 geode-web-management-1.13.1.war

The Developer REST API is contained in the geode-web-api-1.13.1.war file. You can inspect the contents of the WAR by running the following command:

$ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war | less

Unfortunately, from here, running the Apache Geode Developer REST API from a Spring Boot initialized Apache Geode server was anything but trivial. And, as I suspect you discovered based on the title of your email, it has everything to do with Swagger. 😞

It is rather naive that Apache Geode enables Swagger when enabling/starting the Developer REST API since:

A) Swagger (while arguably convenient) is not needed to run the Developer REST API.

B) There is no way to opt-out or disable Swagger if you don't want to run it, especially since....

C) Neither Developer REST API nor Swagger are secure (HTTPS) by default and therefore poses a serious security risk, regardless if Geode is behind some firewall or (worse) not!

Anyway! I suspect you hit this rather annoying Exception...

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.
Caused by: java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.

This Exception is not enough to prevent the Aapche Geode server from starting and running, but the Developer REST API will also NOT be available, either.

No doubt, Swagger is causing ClassLoader issues, specifically between the child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the parent/main app ClassLoader used to boostrap the Spring Boot application (and eventually the Apache Geode CacheServer)! Spring Boot's o.s.b.a.c.OnWebApplicationCondition is very much a Spring Framework o.s.c.a.Condition!

I worked around this issue by disabling Swagger!  However, this was the non-trivial part.

Since Swagger does not provide a property or any other means to disable it, and Apache Geode did NOT provide an option to enable (opt-in; which should have been the default) or (rather) be able to disable (opt-out) the Swagger configuration (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221520289%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wOb8auIHz3AC%2BYjNkefMd%2BHAHyJhZKLmiJrrRXy3txk%3D&reserved=0> [9]), such as via a Spring Profile as it should have (!), then your only option is to rebuild the WAR file.

I specifically (from a tmp directory)...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
3) jar -cvf geode-web-api-1.13.1.war
4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions

NOTE: It is probably a good idea to backup the original WAR file.

The rm -Rf​ command in #2 above remove the o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures and initializes Swagger inthe first place, thereby effectively disabling Swagger.

After dropping in the newly built WAR file, I can now run the Developer REST API from a Spring Boot bootstrapped and configured Apache Geode Server. \o/

To make ensure everything worked, I put some test data into an Apache Geode, cache Region ("/Users"); see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221520289%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uMLdEGhYykvliDNC%2Byf59LT%2FjafoA9U8EDoOznGxFr8%3D&reserved=0>. [10]

I verified this with Gfsh:

$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  /
 / /__/ / ____/  _____/ / /    / /
/______/_/      /______/_/    /_/    1.13.1

Monitor and Manage Apache Geode


gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.24, port=1099] ..
Successfully connected to: [host=10.99.199.24, port=1099]

You are connected to a cluster of version: 1.13.1


gfsh>list members
Member Count : 1

              Name                | Id
--------------------------------- | ---------------------------------------------------------------------------------
SpringBasedCacheServerApplication | 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000 [Coordinator]

gfsh>describe member --name=SpringBasedCacheServerApplication
Name        : SpringBasedCacheServerApplication
Id          : 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
Host        : 10.99.199.24
Regions     : Users
PID         : 46385
Groups      :
Used Heap   : 366M
Max Heap    : 3641M
Working Dir : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Log file    : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Locators    : localhost[10334]

Cache Server Information
Server Bind              :
Server Port              : 40404
Running                  : true

Client Connections : 0


gfsh>list regions
List of regions
---------------
Users


gfsh>describe region --name=/Users
Name            : Users
Data Policy     : partition
Hosting Members : SpringBasedCacheServerApplication

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 2
       | data-policy | PARTITION


gfsh>query --query="SELECT u FROM /Users u"
Result : true
Limit  : 100
Rows   : 2

id | name
-- | ---------
1  | "jonDoe"
2  | "janeDoe"


Finally, I ran curl against the /Users Region

$ curl http://localhost:7070/geode/v1/Users
{
  "Users" : [ {
    "id" : 1,
    "name" : "jonDoe"
  }, {
    "id" : 2,
    "name" : "janeDoe"
  } ]

Which is proof that the Developer REST API is running!

Hope this helps!

Regards,
John


[1] https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221530285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=riACxowX9pZtjCoEq%2FpodYcSU8fBkR1aIJ4Upda%2BTL0%3D&reserved=0>
[2] https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221530285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kaHgQQfR2gJE0P7Jj%2BD5C4jAbSX5Oi1BcHPYRZ1Wvjw%3D&reserved=0>
[3] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221540275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SsxgipIrSXdojIpT3rSsqnlYlpC7EVzCabXPQpW8buY%3D&reserved=0>
[4] https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221540275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YcLHb7Rm2TtvIiEwHo%2BuWxAvcNC65TILO4PpKQflSnc%3D&reserved=0>
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221550275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GwkK4m5eUfN6raDIDmBUGWlyTM3NFwjnaa%2FklqsLrNo%3D&reserved=0>
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221560262%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=UUahKs5K8CpURo12McMA1RCip9BqlK%2BG6Bckc9VuQrw%3D&reserved=0>
[7] https://geode.apache.org/releases/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221560262%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=T2i%2F7lgSYY5VYyC9yIcGZuCIhCVCdQdpARrDntTQHy8%3D&reserved=0>
[8] https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221570260%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RwTsuwgsb4dL1y4iExinGl5EjQqiiOjUvQsA2hO2rPs%3D&reserved=0>
[9] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221570260%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=P8J%2F1P2EofhxpQXP9RwOI9dbNPAy5wfdsDSdUkXWDs4%3D&reserved=0>
[10] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221580256%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HM5eWgPMHYjPstPIh5Acmt%2BeGgd0kkh8IaNODVKU8%2B0%3D&reserved=0>


________________________________
From: Pratibha Ayengar <pr...@gmail.com>
Sent: Tuesday, February 16, 2021 8:52 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221580256%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MbnzgWQPqFJkGYRG4bkmq9tMCZXr458WNOl98%2F45mg8%3D&reserved=0>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221590250%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Yv4il6%2B8GYJQLRX0UbWoS0Y9xk%2F0ykXIgsMbbe9E4jQ%3D&reserved=0>" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221590250%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PLEBRbp1qA%2FGRqkE4buakvNKOQo8IBY2IGy2PsUFmSA%3D&reserved=0> https://maven.apache.org/xsd/maven-4.0.0.xsd<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7C892f21821a1b4f42d3f608d8d382d5ef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491906221600245%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dN%2B81ZV%2BCL7LRwQuGO4ZDti%2BQ7p4F2kFQZeGtZ5cZJM%3D&reserved=0>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:

Hi Pratibha,



In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:



start-dev-rest-api=true



In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:



[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode



[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war



[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api



[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...



[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'



[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)



In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).



Also, the Swagger UI is only available from servers and is not available on the locator.



Hope this helps.

--Jens



From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue



Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())

This is the one that seems to be failing.



Thanks,

Pratibha





On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:

// Check if we're already running inside Tomcat

        if (isRunningInTomcat()) {

            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");

        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {

            Map<String, Object> securityServiceAttr = new HashMap<>();

            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);

            if (cache.getOptionalService(HttpService.class).isPresent()) {

                HttpService httpService = cache.getOptionalService(HttpService.class).get();

                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);

                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);

                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);

            } else {

                logger.warn("HttpService is not available - could not start Dev REST API");

            }



Is this any help?



cheers



From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue



This email has reached the company via an external source.

Please be cautious opening any attachments or links.


Hi Aashish,



Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?



2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Thanks,

Pratibha



On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:

For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.

With best regards,
Ashish



On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:



Hi Geode Team,



I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.



We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.



Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.



SpringBoot version - 2.3.0.RELEASE



Locator start command

start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties



JVM arguments used while starting server

-Dgemfire.home=D:\apache-geode-1.12.0



Line in the logs that show the API is not available -

2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Appreciate any help I can get.



Thank you,

Pratibha Ayengar



Re: Apache geode 1.12.0 swagger UI issue

Posted by John Blum <jb...@vmware.com>.
Hi Pratibha-

A quick update...

First, I apologize for the typos in my first 2 emails; it was quite late my time when I tried to figure out the problem you were having.

Second, I tried a slightly different approach today to see if I could get the Developer REST API working along with the Swagger UI.

In a nutshell, I tried to keep Swagger (UI) in play by not removing the Apache Geode internal SwaggerConfig class (this<https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java> [1]) from the apache-geode-<version>/tools/Extensions/geode-web-api-<version>.war file and instead removed the core Spring Framework JAR files contained in WEB-INF/lib, thereby letting the application main/parent ('app') ClassLoader resolve and load the core Spring Framework classes.  That is, let the main ('app'), or "parent" ClassLoader resolve core Spring Framework classes while the "child" Jetty WebAppClassLoader resolves classes only required the embedded Webapps not used by the Spring Boot application, e.g. like Swagger.

Since you are using Spring Boot to bootstrap and configure an Apache Geode server with the Developer REST API enabled, it would be best to let the main/parent ClassLoader do the loading for the core Spring Framework classes.

Even though, Servlet Container ClassLoaders are child-first (to preserve Webapp isolation), they still delegate up to the parent. Of course, in the embedded Servlet Container case, I am not sure if that is the case since Java is parent-first (for security reasons); I sort of remember otherwise.  Anyway...

1) I tried with both Apache Geode 1.13.1 as well as 1.12.0.

2) Which means I rolled back to Spring Boot 2.3.8.RELEASE, which is based on core Spring Framework 5.2 matching the version of Spring used by the Apache Geode Developer REST API. I also rolled back SBDG to 1.3.8.RELEASE, matching Spring Boot 2.3.

3) I ran rm -Rf `find WEB-INF/lib/ -name "spring-*-5.2.*.RELEASE.jar" | grep -v "spring-security"` to remove the core Spring Framework JARS from the (e.g.) apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war file, WEB-INF/lib dir.

4) I played around with setting the jackson-bom.version property in my application Maven POM, to match Apache Geode's Jackson version of 2.10.[1|0], as apparent in the WAR file as well as tried to match Jackson with the version expected by Springfox Swagger (see here<https://github.com/springfox/springfox/blob/2.9.2/gradle/dependencies.gradle#L9> [2]).

5) I even tried to remove Jackson from the geode-web-api-1.12.0.war file as well.

I either got a NoClassDefFoundError/ClassNotFoundException on the Jackson ObjectMapper class (when removing Jackson from the WAR; #5) or this Exception when Jackson was present...

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.geode.rest.internal.web.http.converter.CustomMappingJackson2HttpMessageConverter#0' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Cannot resolve reference to bean 'objectMapper' while setting bean property 'objectMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in ServletContext resource [/WEB-INF/geode-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
Caused by: org.springframework.beans.FatalBeanException: Unknown feature class: com.fasterxml.jackson.core.JsonParser$Feature
...
..
.

Currently, I am out of ideas, but Java's ClassLoader mechanism is apparently running interference here. Anyway, as I stated above, I wanted to share this information with you in case it gives you more ideas of things to try.

Of course, if Swagger is not strictly required in your Use Case, then you can use the approach I outlined in my email below (also see here<http://markmail.org/message/stpa4tl55qybpeo7> [3]).

Ultimately, I think...

1) Swagger should not be enabled by default in Apache Geode when using the Developer REST API, and...
2) Using (enabling) Swagger with Apache Geode Developer REST API should be an opt-in feature (enabled with a Spring Profile), which would help to avoid the issue in this case.

Good luck!

Regards,
John

[1] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
[2] https://github.com/springfox/springfox/blob/2.9.2/gradle/dependencies.gradle#L9
[3] http://markmail.org/message/stpa4tl55qybpeo7

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:29 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Slight correct to...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Which should have read...

1) jar -xvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Sorry,
John

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:18 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

I have tried to (loosely) cover this topic in the Spring for Apache Geode documentation:

* See Spring Data for Apache Geode (SDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908205618%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hDhrzEvTUFsNezp3E%2FEFjEtx1KKCjzT3g1Kixnx0mUM%3D&reserved=0>. [1]

* See Spring Boot for Apache Geode (SBDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908215620%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=OnRBXH18eAcHT9itqh05Vqx2EE94f51iBOVibXQDWxQ%3D&reserved=0> [2], and specifically, see the section titled, "Additional Manager dependencies expressed in Gradle".

I built an example to show how to (partly) accomplish this Use Case (UC) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908215620%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2PrS02ojJ9RVnZ2WolWzn9todeh6j7oqGXBEEsfoImQ%3D&reserved=0>. [3]

To be clear about what the UC actually is, you want to use Spring Boot to bootstrap and configure an Apache Geode server running the Developer REST API<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908225618%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Nh8rRsBT%2FSpAGFv6MiKQ8jrvll2KBNQLgC3o4OZpxhg%3D&reserved=0>. [4]

To be able to run any of Apache Geode's provided Web applications [Developer REST API, Pulse, Management REST API], you must first enable the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP service to host the (aforementioned) Web applications provided in the Apache Geode distribution.

It's rather trivial to start the embedded HTTP service. To do this:

1) Simply annotate your Spring (Boot) application @Configuration with SDG's @EnableHttpService annotation and set the startDeveloperRestApi attribute to true (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908225618%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4hITZE5LKj6V2lIgWq1BNwKreCtqLoFnPbmi162Nmx0%3D&reserved=0> [5]), then...

2)  Declare the 'org.apache.geode:geode-http-service' as a runtime dependency (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908235606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DvT%2FAXYvyBfOBn9cIhS1LjqUlIzDbZgCO%2FT8xEUFR%2Fc%3D&reserved=0> [6]) in your Maven POM or Gradle build file, and finally...

NOTE: Despite the SBDG docs in [2], you don't actually need the 'org.apache.geode:geode-web' dependency nor do you need to declare 'org.springframework.boot:spring-boot-starter-jetty' since 'geode-http-service' includes Jetty for you.

3) You must set the GEODE_HOME environment variable or alternatively, the "gemfire.home" System property to the absolute path of the Apache Geode distribution installed on your system.

I have the Apache Geode 1.13.1 distribution installed at  /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode (binaries & source) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908245601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=y6dFI2Menf6c2Qbysl9zM0DYOR3TO7GCmVBrvn%2B%2B0gQ%3D&reserved=0> [7].

Setting the GEODE_HOME environment variable or the "gemfire.home" System property will be system dependent and also depend on how you launch your Spring Boot, Apache Geode server.

For example, by using the Spring Boot Maven Plugin<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908245601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NYsucAWTxQgI9UpRymN1zXmlwQjnYsUwoO%2Fe8k1EStM%3D&reserved=0>: [8]

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"

The Apache Geode Management REST API, Developer REST API & Pulse are all WAR files that are part of the Apache Geode distribution, so must tell Apache Geode where you install Apache Geode so it can find things.

For example, the Developer REST API WAR file lives here:

$ ls -la apache-geode-1.13.1/tools/Extensions/
total 88528
drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
-rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27 geode-web-management-1.13.1.war

The Developer REST API is contained in the geode-web-api-1.13.1.war file. You can inspect the contents of the WAR by running the following command:

$ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war | less

Unfortunately, from here, running the Apache Geode Developer REST API from a Spring Boot initialized Apache Geode server was anything but trivial. And, as I suspect you discovered based on the title of your email, it has everything to do with Swagger. 😞

It is rather naive that Apache Geode enables Swagger when enabling/starting the Developer REST API since:

A) Swagger (while arguably convenient) is not needed to run the Developer REST API.

B) There is no way to opt-out or disable Swagger if you don't want to run it, especially since....

C) Neither Developer REST API nor Swagger are secure (HTTPS) by default and therefore poses a serious security risk, regardless if Geode is behind some firewall or (worse) not!

Anyway! I suspect you hit this rather annoying Exception...

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.
Caused by: java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.

This Exception is not enough to prevent the Aapche Geode server from starting and running, but the Developer REST API will also NOT be available, either.

No doubt, Swagger is causing ClassLoader issues, specifically between the child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the parent/main app ClassLoader used to boostrap the Spring Boot application (and eventually the Apache Geode CacheServer)! Spring Boot's o.s.b.a.c.OnWebApplicationCondition is very much a Spring Framework o.s.c.a.Condition!

I worked around this issue by disabling Swagger!  However, this was the non-trivial part.

Since Swagger does not provide a property or any other means to disable it, and Apache Geode did NOT provide an option to enable (opt-in; which should have been the default) or (rather) be able to disable (opt-out) the Swagger configuration (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908255597%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=O7ELeuJAN4GXO2rfM1MbbskCh2oRbOycJXxVuk15xnk%3D&reserved=0> [9]), such as via a Spring Profile as it should have (!), then your only option is to rebuild the WAR file.

I specifically (from a tmp directory)...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
3) jar -cvf geode-web-api-1.13.1.war
4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions

NOTE: It is probably a good idea to backup the original WAR file.

The rm -Rf​ command in #2 above remove the o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures and initializes Swagger inthe first place, thereby effectively disabling Swagger.

After dropping in the newly built WAR file, I can now run the Developer REST API from a Spring Boot bootstrapped and configured Apache Geode Server. \o/

To make ensure everything worked, I put some test data into an Apache Geode, cache Region ("/Users"); see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908255597%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Xj01OcioAZVoRT%2BX3EtfLB61rY%2FD4AwJhowZ4UdoPh4%3D&reserved=0>. [10]

I verified this with Gfsh:

$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  /
 / /__/ / ____/  _____/ / /    / /
/______/_/      /______/_/    /_/    1.13.1

Monitor and Manage Apache Geode


gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.24, port=1099] ..
Successfully connected to: [host=10.99.199.24, port=1099]

You are connected to a cluster of version: 1.13.1


gfsh>list members
Member Count : 1

              Name                | Id
--------------------------------- | ---------------------------------------------------------------------------------
SpringBasedCacheServerApplication | 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000 [Coordinator]

gfsh>describe member --name=SpringBasedCacheServerApplication
Name        : SpringBasedCacheServerApplication
Id          : 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
Host        : 10.99.199.24
Regions     : Users
PID         : 46385
Groups      :
Used Heap   : 366M
Max Heap    : 3641M
Working Dir : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Log file    : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Locators    : localhost[10334]

Cache Server Information
Server Bind              :
Server Port              : 40404
Running                  : true

Client Connections : 0


gfsh>list regions
List of regions
---------------
Users


gfsh>describe region --name=/Users
Name            : Users
Data Policy     : partition
Hosting Members : SpringBasedCacheServerApplication

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 2
       | data-policy | PARTITION


gfsh>query --query="SELECT u FROM /Users u"
Result : true
Limit  : 100
Rows   : 2

id | name
-- | ---------
1  | "jonDoe"
2  | "janeDoe"


Finally, I ran curl against the /Users Region

$ curl http://localhost:7070/geode/v1/Users
{
  "Users" : [ {
    "id" : 1,
    "name" : "jonDoe"
  }, {
    "id" : 2,
    "name" : "janeDoe"
  } ]

Which is proof that the Developer REST API is running!

Hope this helps!

Regards,
John


[1] https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908265589%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HpnRvLdpmKvIVw8n%2FpcOq5qSX7s74jGNJEU3rPsQDmg%3D&reserved=0>
[2] https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908275584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=icw0IoLSX9GkkcFWE6x0lgkxC%2BLRVKJ%2B4iz2aHTob8w%3D&reserved=0>
[3] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908275584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AmgV7MFZyzL4wFluTX5dKC5lo6DnKUcQz066M3hJRB4%3D&reserved=0>
[4] https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908285577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=UudayxQw04VB%2FMv5nM7N2j63hR1xEGLIK8QaoQMccYs%3D&reserved=0>
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908285577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=A76C2hraTRmXBmd6hSxmusnzgH1nQMR5yXdaDutiano%3D&reserved=0>
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908295573%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lHmoA%2F5KOi1lqZ0bLG1yUaWPIhqHM%2BniA9wGa%2BzwlL8%3D&reserved=0>
[7] https://geode.apache.org/releases/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908305566%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bTozHHazyDZtH5ZOpmp24xlzuzYIjF1rzpDbcuyUIDs%3D&reserved=0>
[8] https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908305566%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bWvnr7TJK5KnAR8umoRqxYq9RhIcObJJfMZa9t1al88%3D&reserved=0>
[9] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908315564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=W%2B7iD%2BD4IPBvW7U3p8dCIgYdJq%2FfMDBGbmC6ZjL7tew%3D&reserved=0>
[10] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908315564%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=zZgIxqtIdizNdEfNGiv5tFmliVpYAnIPcPOmS4cGDzo%3D&reserved=0>


________________________________
From: Pratibha Ayengar <pr...@gmail.com>
Sent: Tuesday, February 16, 2021 8:52 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908325558%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=WMKr3avPJnVik9xrOuJcA6N3YHHMHaYIhaQRzhYNW8I%3D&reserved=0>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908335552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3gQVvnpKxJlessRb%2BW1UwFRLOz5t4%2F2khM%2FJvMzaXkU%3D&reserved=0>" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908335552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VWOqE7mjXnagKqphrHvXkhcOOOw9Yej8kzRg0TjCzpw%3D&reserved=0> https://maven.apache.org/xsd/maven-4.0.0.xsd<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7C01d15d9178fb4e10baf008d8d32ef3b6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491545908345542%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=R79wvnffIjWieRh0TKxqrkZ8oC6hAdKdEsny7JsX9aM%3D&reserved=0>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:

Hi Pratibha,



In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:



start-dev-rest-api=true



In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:



[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode



[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war



[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api



[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...



[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'



[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)



In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).



Also, the Swagger UI is only available from servers and is not available on the locator.



Hope this helps.

--Jens



From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue



Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())

This is the one that seems to be failing.



Thanks,

Pratibha





On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:

// Check if we're already running inside Tomcat

        if (isRunningInTomcat()) {

            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");

        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {

            Map<String, Object> securityServiceAttr = new HashMap<>();

            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);

            if (cache.getOptionalService(HttpService.class).isPresent()) {

                HttpService httpService = cache.getOptionalService(HttpService.class).get();

                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);

                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);

                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);

            } else {

                logger.warn("HttpService is not available - could not start Dev REST API");

            }



Is this any help?



cheers



From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue



This email has reached the company via an external source.

Please be cautious opening any attachments or links.


Hi Aashish,



Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?



2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Thanks,

Pratibha



On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:

For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.

With best regards,
Ashish



On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:



Hi Geode Team,



I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.



We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.



Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.



SpringBoot version - 2.3.0.RELEASE



Locator start command

start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties



JVM arguments used while starting server

-Dgemfire.home=D:\apache-geode-1.12.0



Line in the logs that show the API is not available -

2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Appreciate any help I can get.



Thank you,

Pratibha Ayengar



Re: Apache geode 1.12.0 swagger UI issue

Posted by John Blum <jb...@vmware.com>.
Slight correct to...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Which should have read...

1) jar -xvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war

Sorry,
John

________________________________
From: John Blum <jb...@vmware.com>
Sent: Wednesday, February 17, 2021 2:18 AM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Pratibha-

I have tried to (loosely) cover this topic in the Spring for Apache Geode documentation:

* See Spring Data for Apache Geode (SDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225312958%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5IYtH93zvh0Qsut9p67giqQ4ZjLF8FkYggyum5RnpIs%3D&reserved=0>. [1]

* See Spring Boot for Apache Geode (SBDG) docs here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225312958%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DvIjW%2FFIc8uHuxW4f55YGDRaVqKeIX2jTopENcawLps%3D&reserved=0> [2], and specifically, see the section titled, "Additional Manager dependencies expressed in Gradle".

I built an example to show how to (partly) accomplish this Use Case (UC) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225322944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=djaBDEiTV%2Fkpd0gv9k%2F318H0XJklXsCAf3hX3VMuDvM%3D&reserved=0>. [3]

To be clear about what the UC actually is, you want to use Spring Boot to bootstrap and configure an Apache Geode server running the Developer REST API<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225322944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XMet99C2wADq5n9gLWsFlXJcxCoq9U1CF5CWM2kbJlY%3D&reserved=0>. [4]

To be able to run any of Apache Geode's provided Web applications [Developer REST API, Pulse, Management REST API], you must first enable the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP service to host the (aforementioned) Web applications provided in the Apache Geode distribution.

It's rather trivial to start the embedded HTTP service. To do this:

1) Simply annotate your Spring (Boot) application @Configuration with SDG's @EnableHttpService annotation and set the startDeveloperRestApi attribute to true (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225332938%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JqikZYVFOwYbOMfpUnreOYupou2DIXbDsMXj0Qb6bXs%3D&reserved=0> [5]), then...

2)  Declare the 'org.apache.geode:geode-http-service' as a runtime dependency (for example<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225332938%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2nJeA%2BWzxnfdXW7iWipAsVDaTjjUghtKPksPGQ3Q18o%3D&reserved=0> [6]) in your Maven POM or Gradle build file, and finally...

NOTE: Despite the SBDG docs in [2], you don't actually need the 'org.apache.geode:geode-web' dependency nor do you need to declare 'org.springframework.boot:spring-boot-starter-jetty' since 'geode-http-service' includes Jetty for you.

3) You must set the GEODE_HOME environment variable or alternatively, the "gemfire.home" System property to the absolute path of the Apache Geode distribution installed on your system.

I have the Apache Geode 1.13.1 distribution installed at  /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode (binaries & source) here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225342937%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JJlT7IgW6Z%2BQn4N%2B6ITDt1fwbf4ltAEP3NAGxOnPQd8%3D&reserved=0> [7].

Setting the GEODE_HOME environment variable or the "gemfire.home" System property will be system dependent and also depend on how you launch your Spring Boot, Apache Geode server.

For example, by using the Spring Boot Maven Plugin<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225342937%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=i3BG%2B7O2usJLW%2Bhsv9nsVMehx0H2fm6NOXy%2B41FuIgo%3D&reserved=0>: [8]

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"

The Apache Geode Management REST API, Developer REST API & Pulse are all WAR files that are part of the Apache Geode distribution, so must tell Apache Geode where you install Apache Geode so it can find things.

For example, the Developer REST API WAR file lives here:

$ ls -la apache-geode-1.13.1/tools/Extensions/
total 88528
drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
-rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27 geode-web-management-1.13.1.war

The Developer REST API is contained in the geode-web-api-1.13.1.war file. You can inspect the contents of the WAR by running the following command:

$ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war | less

Unfortunately, from here, running the Apache Geode Developer REST API from a Spring Boot initialized Apache Geode server was anything but trivial. And, as I suspect you discovered based on the title of your email, it has everything to do with Swagger. 😞

It is rather naive that Apache Geode enables Swagger when enabling/starting the Developer REST API since:

A) Swagger (while arguably convenient) is not needed to run the Developer REST API.

B) There is no way to opt-out or disable Swagger if you don't want to run it, especially since....

C) Neither Developer REST API nor Swagger are secure (HTTPS) by default and therefore poses a serious security risk, regardless if Geode is behind some firewall or (worse) not!

Anyway! I suspect you hit this rather annoying Exception...

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.
Caused by: java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.

This Exception is not enough to prevent the Aapche Geode server from starting and running, but the Developer REST API will also NOT be available, either.

No doubt, Swagger is causing ClassLoader issues, specifically between the child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the parent/main app ClassLoader used to boostrap the Spring Boot application (and eventually the Apache Geode CacheServer)! Spring Boot's o.s.b.a.c.OnWebApplicationCondition is very much a Spring Framework o.s.c.a.Condition!

I worked around this issue by disabling Swagger!  However, this was the non-trivial part.

Since Swagger does not provide a property or any other means to disable it, and Apache Geode did NOT provide an option to enable (opt-in; which should have been the default) or (rather) be able to disable (opt-out) the Swagger configuration (see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225352934%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ST1T6Z5o8zmC%2B0VpR2XPtTva24eunLlCYWA1p%2F3VDQE%3D&reserved=0> [9]), such as via a Spring Profile as it should have (!), then your only option is to rebuild the WAR file.

I specifically (from a tmp directory)...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
3) jar -cvf geode-web-api-1.13.1.war
4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions

NOTE: It is probably a good idea to backup the original WAR file.

The rm -Rf​ command in #2 above remove the o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures and initializes Swagger inthe first place, thereby effectively disabling Swagger.

After dropping in the newly built WAR file, I can now run the Developer REST API from a Spring Boot bootstrapped and configured Apache Geode Server. \o/

To make ensure everything worked, I put some test data into an Apache Geode, cache Region ("/Users"); see here<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225352934%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MNRnO6U7CECPEHgMgsbY2cfUQZhQm7PI1GnHbSY3BgY%3D&reserved=0>. [10]

I verified this with Gfsh:

$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  /
 / /__/ / ____/  _____/ / /    / /
/______/_/      /______/_/    /_/    1.13.1

Monitor and Manage Apache Geode


gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.24, port=1099] ..
Successfully connected to: [host=10.99.199.24, port=1099]

You are connected to a cluster of version: 1.13.1


gfsh>list members
Member Count : 1

              Name                | Id
--------------------------------- | ---------------------------------------------------------------------------------
SpringBasedCacheServerApplication | 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000 [Coordinator]

gfsh>describe member --name=SpringBasedCacheServerApplication
Name        : SpringBasedCacheServerApplication
Id          : 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
Host        : 10.99.199.24
Regions     : Users
PID         : 46385
Groups      :
Used Heap   : 366M
Max Heap    : 3641M
Working Dir : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Log file    : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Locators    : localhost[10334]

Cache Server Information
Server Bind              :
Server Port              : 40404
Running                  : true

Client Connections : 0


gfsh>list regions
List of regions
---------------
Users


gfsh>describe region --name=/Users
Name            : Users
Data Policy     : partition
Hosting Members : SpringBasedCacheServerApplication

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 2
       | data-policy | PARTITION


gfsh>query --query="SELECT u FROM /Users u"
Result : true
Limit  : 100
Rows   : 2

id | name
-- | ---------
1  | "jonDoe"
2  | "janeDoe"


Finally, I ran curl against the /Users Region

$ curl http://localhost:7070/geode/v1/Users
{
  "Users" : [ {
    "id" : 1,
    "name" : "jonDoe"
  }, {
    "id" : 2,
    "name" : "janeDoe"
  } ]

Which is proof that the Developer REST API is running!

Hope this helps!

Regards,
John


[1] https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-data%2Fgeode%2Fdocs%2Fcurrent%2Freference%2Fhtml%2F%23bootstrap-annotation-config-embedded-services-http&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225362926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BExDqqnhU4bKl47%2BnO%2BWyHuOoxdb9YtPPUUrplhKKqU%3D&reserved=0>
[2] https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot-data-geode-build%2Fcurrent%2Freference%2Fhtml5%2Findex.html%23geode-manager-applications&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225362926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ad64%2Blz1PNnCPLgetZ0JkTJ1wauzOngx%2F153DUE45Ig%3D&reserved=0>
[3] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Ftree%2Fmaster%2Fspring-geode-server-restapi&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225372922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=P8ZSoOen%2BqJbaWSd28oyur%2BkEW%2FSx3Z1Fy%2FCk73Ym38%3D&reserved=0>
[4] https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F113%2Frest_apps%2Fchapter_overview.html&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225372922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=glIOspHOJjlQxHfQh0Q2HbkccHC8T3qZAuNtEV%2ForAo%3D&reserved=0>
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L93&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225382918%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IIokE09OEbqLTJ5lXGKtjIZe1BFfIQnZf1yg3QgXdUY%3D&reserved=0>
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fpom.xml%23L34-L39&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225392909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XvXQ1MzP5VYQhm%2BTZrj1zs3R%2Fljy2lAVbVt3jz0TOWY%3D&reserved=0>
[7] https://geode.apache.org/releases/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Freleases%2F&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225392909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sxiaCGfli08lOBpGdgtbpc2sl4Ik%2BWvA9dzjH3z0d%2BA%3D&reserved=0>
[8] https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2F2.4.1%2Fmaven-plugin%2Freference%2Fhtmlsingle%2F&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225402904%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nYdmcScS7Wm4ohuGYZel34d5LgK9aERup7doEpALb3g%3D&reserved=0>
[9] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fblob%2Frel%2Fv1.13.1%2Fgeode-web-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Frest%2Finternal%2Fweb%2Fswagger%2Fconfig%2FSwaggerConfig.java&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225402904%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HLU1Ho1cStxoAesFyFCAB%2B7e21I5d6KAaJf%2BmXbon1E%3D&reserved=0>
[10] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjxblum%2Fstackoverflow-questions-answers%2Fblob%2Fmaster%2Fspring-geode-server-restapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgeode%2Fquestions%2Fuserdevlist%2Fdevrestapi%2FSpringBootApacheGeodeServerRestApiApplication.java%23L75-L78&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225412900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=St%2BMzUKbXSlBjHZ%2FU%2F7zmXxIANTnubsAD4SbSnYDK44%3D&reserved=0>


________________________________
From: Pratibha Ayengar <pr...@gmail.com>
Sent: Tuesday, February 16, 2021 8:52 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225412900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lfDStO1AmB4n3wOk8GxpJs4%2BUKg3HtCWtSx8VM9TuN0%3D&reserved=0>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225422897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=OudpbBF4KPpPOTe4R%2BR%2BVaup%2Bv0uxGm4le0QF1YuZ8c%3D&reserved=0>" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225422897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Csvh7QFyGnjimiXal5Mz616A2EURf%2FXJ1ud4Uhj0fbM%3D&reserved=0> https://maven.apache.org/xsd/maven-4.0.0.xsd<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7Cd83a3e4242754612080008d8d32d6546%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491539225432885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AymxNfvhJI%2FlAfHqkSPAKZ43UsvIeILz3H%2FxDY%2BJX7E%3D&reserved=0>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:

Hi Pratibha,



In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:



start-dev-rest-api=true



In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:



[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode



[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war



[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api



[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...



[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'



[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)



In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).



Also, the Swagger UI is only available from servers and is not available on the locator.



Hope this helps.

--Jens



From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue



Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())

This is the one that seems to be failing.



Thanks,

Pratibha





On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:

// Check if we're already running inside Tomcat

        if (isRunningInTomcat()) {

            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");

        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {

            Map<String, Object> securityServiceAttr = new HashMap<>();

            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);

            if (cache.getOptionalService(HttpService.class).isPresent()) {

                HttpService httpService = cache.getOptionalService(HttpService.class).get();

                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);

                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);

                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);

            } else {

                logger.warn("HttpService is not available - could not start Dev REST API");

            }



Is this any help?



cheers



From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue



This email has reached the company via an external source.

Please be cautious opening any attachments or links.


Hi Aashish,



Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?



2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Thanks,

Pratibha



On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:

For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.

With best regards,
Ashish



On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:



Hi Geode Team,



I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.



We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.



Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.



SpringBoot version - 2.3.0.RELEASE



Locator start command

start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties



JVM arguments used while starting server

-Dgemfire.home=D:\apache-geode-1.12.0



Line in the logs that show the API is not available -

2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Appreciate any help I can get.



Thank you,

Pratibha Ayengar



Re: Apache geode 1.12.0 swagger UI issue

Posted by John Blum <jb...@vmware.com>.
Hi Pratibha-

I have tried to (loosely) cover this topic in the Spring for Apache Geode documentation:

* See Spring Data for Apache Geode (SDG) docs here<https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http>. [1]

* See Spring Boot for Apache Geode (SBDG) docs here<https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications> [2], and specifically, see the section titled, "Additional Manager dependencies expressed in Gradle".

I built an example to show how to (partly) accomplish this Use Case (UC) here<https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi>. [3]

To be clear about what the UC actually is, you want to use Spring Boot to bootstrap and configure an Apache Geode server running the Developer REST API<https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html>. [4]

To be able to run any of Apache Geode's provided Web applications [Developer REST API, Pulse, Management REST API], you must first enable the embedded HTTP service. Apache Geode uses Jetty to run an embedded HTTP service to host the (aforementioned) Web applications provided in the Apache Geode distribution.

It's rather trivial to start the embedded HTTP service. To do this:

1) Simply annotate your Spring (Boot) application @Configuration with SDG's @EnableHttpService annotation and set the startDeveloperRestApi attribute to true (for example<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93> [5]), then...

2)  Declare the 'org.apache.geode:geode-http-service' as a runtime dependency (for example<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39> [6]) in your Maven POM or Gradle build file, and finally...

NOTE: Despite the SBDG docs in [2], you don't actually need the 'org.apache.geode:geode-web' dependency nor do you need to declare 'org.springframework.boot:spring-boot-starter-jetty' since 'geode-http-service' includes Jetty for you.

3) You must set the GEODE_HOME environment variable or alternatively, the "gemfire.home" System property to the absolute path of the Apache Geode distribution installed on your system.

I have the Apache Geode 1.13.1 distribution installed at  /Users/jblum/pivdev/apache-geode-1.13.1. You can download Apache Geode (binaries & source) here<https://geode.apache.org/releases/> [7].

Setting the GEODE_HOME environment variable or the "gemfire.home" System property will be system dependent and also depend on how you launch your Spring Boot, Apache Geode server.

For example, by using the Spring Boot Maven Plugin<https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/>: [8]

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dgemfire.home=/Users/jblum/pivdev/apache-geode-1.13.1"

The Apache Geode Management REST API, Developer REST API & Pulse are all WAR files that are part of the Apache Geode distribution, so must tell Apache Geode where you install Apache Geode so it can find things.

For example, the Developer REST API WAR file lives here:

$ ls -la apache-geode-1.13.1/tools/Extensions/
total 88528
drwxr-xr-x@ 5 jblum  staff       160 Nov 12 16:27 .
drwxr-xr-x@ 6 jblum  staff       192 Nov 12 16:27 ..
-rw-r--r--@ 1 jblum  staff   5948726 Nov 12 16:27 geode-web-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19705128 Nov 12 16:27 geode-web-api-1.13.1.war
-rw-r--r--@ 1 jblum  staff  19668143 Nov 12 16:27 geode-web-management-1.13.1.war

The Developer REST API is contained in the geode-web-api-1.13.1.war file. You can inspect the contents of the WAR by running the following command:

$ jar -tvf apache-geode-1.13.1/tools/Extensions/geode-web-api-1.13.1.war | less

Unfortunately, from here, running the Apache Geode Developer REST API from a Spring Boot initialized Apache Geode server was anything but trivial. And, as I suspect you discovered based on the title of your email, it has everything to do with Swagger. 😞

It is rather naive that Apache Geode enables Swagger when enabling/starting the Developer REST API since:

A) Swagger (while arguably convenient) is not needed to run the Developer REST API.

B) There is no way to opt-out or disable Swagger if you don't want to run it, especially since....

C) Neither Developer REST API nor Swagger are secure (HTTPS) by default and therefore poses a serious security risk, regardless if Geode is behind some firewall or (worse) not!

Anyway! I suspect you hit this rather annoying Exception...

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.apache.geode.rest.internal.web.swagger.config.SwaggerConfig]; nested exception is java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.
Caused by: java.lang.ClassCastException: class org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition cannot be cast to class org.springframework.context.annotation.Condition (org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition is in unnamed module of loader 'app'; org.springframework.context.annotation.Condition is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3a2e8c6a)
...
..
.

This Exception is not enough to prevent the Aapche Geode server from starting and running, but the Developer REST API will also NOT be available, either.

No doubt, Swagger is causing ClassLoader issues, specifically between the child, Jetty WebAppClassLoader used to bootstrap the Geode Web apps and the parent/main app ClassLoader used to boostrap the Spring Boot application (and eventually the Apache Geode CacheServer)! Spring Boot's o.s.b.a.c.OnWebApplicationCondition is very much a Spring Framework o.s.c.a.Condition!

I worked around this issue by disabling Swagger!  However, this was the non-trivial part.

Since Swagger does not provide a property or any other means to disable it, and Apache Geode did NOT provide an option to enable (opt-in; which should have been the default) or (rather) be able to disable (opt-out) the Swagger configuration (see here<https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java> [9]), such as via a Spring Profile as it should have (!), then your only option is to rebuild the WAR file.

I specifically (from a tmp directory)...

1) jar -tvf $GEODE_HOME/tools/Extensions/geode-web-api-1.13.1.war
2) rm -Rf WEB-INF/classes/org/apache/geode/rest/internal/web/swagger
3) jar -cvf geode-web-api-1.13.1.war
4) cp geode-web-api-1.13.1.war $GEODE_HOME/tools/Extensions

NOTE: It is probably a good idea to backup the original WAR file.

The rm -Rf​ command in #2 above remove the o.a.g.rest.internal.web.swagger.cofig.SwaggerConfig.class that configures and initializes Swagger inthe first place, thereby effectively disabling Swagger.

After dropping in the newly built WAR file, I can now run the Developer REST API from a Spring Boot bootstrapped and configured Apache Geode Server. \o/

To make ensure everything worked, I put some test data into an Apache Geode, cache Region ("/Users"); see here<https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78>. [10]

I verified this with Gfsh:

$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  /
 / /__/ / ____/  _____/ / /    / /
/______/_/      /______/_/    /_/    1.13.1

Monitor and Manage Apache Geode


gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.24, port=1099] ..
Successfully connected to: [host=10.99.199.24, port=1099]

You are connected to a cluster of version: 1.13.1


gfsh>list members
Member Count : 1

              Name                | Id
--------------------------------- | ---------------------------------------------------------------------------------
SpringBasedCacheServerApplication | 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000 [Coordinator]

gfsh>describe member --name=SpringBasedCacheServerApplication
Name        : SpringBasedCacheServerApplication
Id          : 10.99.199.24(SpringBasedCacheServerApplication:46385)<ec><v0>:41000
Host        : 10.99.199.24
Regions     : Users
PID         : 46385
Groups      :
Used Heap   : 366M
Max Heap    : 3641M
Working Dir : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Log file    : /Users/jblum/pivdev/stackoverflow/questions-answers/spring-geode-server-restapi
Locators    : localhost[10334]

Cache Server Information
Server Bind              :
Server Port              : 40404
Running                  : true

Client Connections : 0


gfsh>list regions
List of regions
---------------
Users


gfsh>describe region --name=/Users
Name            : Users
Data Policy     : partition
Hosting Members : SpringBasedCacheServerApplication

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 2
       | data-policy | PARTITION


gfsh>query --query="SELECT u FROM /Users u"
Result : true
Limit  : 100
Rows   : 2

id | name
-- | ---------
1  | "jonDoe"
2  | "janeDoe"


Finally, I ran curl against the /Users Region

$ curl http://localhost:7070/geode/v1/Users
{
  "Users" : [ {
    "id" : 1,
    "name" : "jonDoe"
  }, {
    "id" : 2,
    "name" : "janeDoe"
  } ]

Which is proof that the Developer REST API is running!

Hope this helps!

Regards,
John


[1] https://docs.spring.io/spring-data/geode/docs/current/reference/html/#bootstrap-annotation-config-embedded-services-http
[2] https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/index.html#geode-manager-applications
[3] https://github.com/jxblum/stackoverflow-questions-answers/tree/master/spring-geode-server-restapi
[4] https://geode.apache.org/docs/guide/113/rest_apps/chapter_overview.html
[5] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L93
[6] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/pom.xml#L34-L39
[7] https://geode.apache.org/releases/
[8] https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/htmlsingle/
[9] https://github.com/apache/geode/blob/rel/v1.13.1/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
[10] https://github.com/jxblum/stackoverflow-questions-answers/blob/master/spring-geode-server-restapi/src/main/java/org/apache/geode/questions/userdevlist/devrestapi/SpringBootApacheGeodeServerRestApiApplication.java#L75-L78


________________________________
From: Pratibha Ayengar <pr...@gmail.com>
Sent: Tuesday, February 16, 2021 8:52 PM
To: user@geode.apache.org <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml file as follows. Starting the server from gfsh works fine. However, from a spring boot app (2.3.0.RELEASE) with these configurations tries to start the API then fails with these lines in the log. I have also tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7Cd0e047597621460e10d608d8d2ffcf3c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491343434747927%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mpglwgDq%2FBs0QJiCsfehJJmbsX2%2BSjcjrev4wfn%2Fsps%3D&reserved=0>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=04%7C01%7Cjblum%40vmware.com%7Cd0e047597621460e10d608d8d2ffcf3c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491343434757926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=NBZu1GT26ls1qBISqeL9LgoYOPUvq2qTd%2FmGUW7gYpU%3D&reserved=0>" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&data=04%7C01%7Cjblum%40vmware.com%7Cd0e047597621460e10d608d8d2ffcf3c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491343434757926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VFDmDCXNl9vnEhCOOJNEBJf1EjvW6ckxG%2BmvE2NqFys%3D&reserved=0> https://maven.apache.org/xsd/maven-4.0.0.xsd<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&data=04%7C01%7Cjblum%40vmware.com%7Cd0e047597621460e10d608d8d2ffcf3c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637491343434767912%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=apBjh%2FCn28VkB%2BWZCDbd5winQ5pr4PeZbUk8PTaHcow%3D&reserved=0>">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com>> wrote:

Hi Pratibha,



In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:



start-dev-rest-api=true



In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:



[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode



[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war



[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api



[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...



[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'



[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)



In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).



Also, the Swagger UI is only available from servers and is not available on the locator.



Hope this helps.

--Jens



From: Pratibha Ayengar <pr...@gmail.com>>
Reply-To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org<ma...@geode.apache.org>" <us...@geode.apache.org>>
Subject: Re: Apache geode 1.12.0 swagger UI issue



Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())

This is the one that seems to be failing.



Thanks,

Pratibha





On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:

// Check if we're already running inside Tomcat

        if (isRunningInTomcat()) {

            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");

        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {

            Map<String, Object> securityServiceAttr = new HashMap<>();

            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);

            if (cache.getOptionalService(HttpService.class).isPresent()) {

                HttpService httpService = cache.getOptionalService(HttpService.class).get();

                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);

                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);

                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);

            } else {

                logger.warn("HttpService is not available - could not start Dev REST API");

            }



Is this any help?



cheers



From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue



This email has reached the company via an external source.

Please be cautious opening any attachments or links.


Hi Aashish,



Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?



2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Thanks,

Pratibha



On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:

For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.

With best regards,
Ashish



On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:



Hi Geode Team,



I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.



We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.



Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.



SpringBoot version - 2.3.0.RELEASE



Locator start command

start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties



JVM arguments used while starting server

-Dgemfire.home=D:\apache-geode-1.12.0



Line in the logs that show the API is not available -

2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API



Appreciate any help I can get.



Thank you,

Pratibha Ayengar



Re: Apache geode 1.12.0 swagger UI issue

Posted by Pratibha Ayengar <pr...@gmail.com>.
Hi Jens,

Thank you for coming back. I do have the configurations in my spring xml
file as follows. Starting the server from gfsh works fine. However, from a
spring boot app (2.3.0.RELEASE) with these configurations tries to start
the API then fails with these lines in the log. I have also
tried @EnableHttpService

2021-02-17 10:18:51.016  INFO 11756 --- [           main]
o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-17 10:18:51.017  INFO 11756 --- [           main]
o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
location:
file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-17 10:18:51.018  WARN 11756 --- [           main]
o.a.geode.management.internal.RestAgent  : HttpService is not available -
could not start Dev REST API


    <util:properties id="geodeProperties">
        <prop key="name">${SERVER_NAME}</prop>
        <prop key="mcast-port">0</prop>
        <prop key="locators">${LOCATORS}</prop>
        <prop key="jmx-manager">false</prop>
        <prop key="jmx-manager-start">false</prop>
        <prop key="http-service-bind-address">localhost</prop>
        <prop key="http-service-port">9301</prop>
        <prop key="http-service-ssl-require-authentication">false</prop>
        <prop key="start-dev-rest-api">true</prop>
        <prop key="enable-network-partition-detection">false</prop>
        <prop key="groups">default</prop>
    </util:properties>

    <geode:cache id="geodeCache"
                 properties-ref="geodeProperties"
                 pdx-serializer-ref="pdxSerializer"
                 enable-auto-reconnect="true"
                 critical-heap-percentage="90"
                 eviction-heap-percentage="80"
                 use-cluster-configuration="true"/>



This is what my pom looks like. Do you see any missing dependency here?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>geode-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>GeodeServer</name>

  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-geode</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Thanks,
Pratibha

On Tue, Feb 16, 2021 at 8:12 PM Jens Deppe <jd...@vmware.com> wrote:

> Hi Pratibha,
>
>
>
> In order to start the Developer REST API (which also exposes the Swagger
> UI) you must set the following properties when you start the server:
>
>
>
> start-dev-rest-api=true
>
>
>
> In order to do this from gfsh you should use the following option:
> --J=-Dgemfire.start-dev-rest-api=true. Or if you have a
> gemfire.properties file then just add the property (without the “gemfire.”
> prefix). In the server log you should see the following lines indicating
> the correct startup of the Dev REST API:
>
>
>
> [info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1]
> GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode
>
>
>
> [info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war:
> geode-web-api at location:
> file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war
>
>
>
> [info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp
> /gemfire-api
>
>
>
> [info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] *Attempting to
> start HTTP service on port (7171) at bind-address (0.0.0.0)...*
>
>
>
> [info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing
> Servlet 'geode'
>
>
>
> [info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean
> 'util:constant#45dc7be' of type
> [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is
> not eligible for getting processed by all BeanPostProcessors (for example:
> not eligible for auto-proxying)
>
>
>
> In the above example I had also set: --J=-Dgemfire.http-service-port=7171
> (the default is normally 7070).
>
>
>
> Also, the Swagger UI is only available from servers and is not available
> on the locator.
>
>
>
> Hope this helps.
>
> --Jens
>
>
>
> *From: *Pratibha Ayengar <pr...@gmail.com>
> *Reply-To: *"user@geode.apache.org" <us...@geode.apache.org>
> *Date: *Monday, February 15, 2021 at 8:52 PM
> *To: *"user@geode.apache.org" <us...@geode.apache.org>
> *Subject: *Re: Apache geode 1.12.0 swagger UI issue
>
>
>
> Thank you, Rupert. This does help narrow it down. Would you be able to
> help on what this particular check is - if (cache.getOptionalService(
> HttpService.class).isPresent())
>
> This is the one that seems to be failing.
>
>
>
> Thanks,
>
> Pratibha
>
>
>
>
>
> On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <
> rupert.stjohnwebster@impress-solutions.com> wrote:
>
> // Check if we're already running inside Tomcat
>
>         if (isRunningInTomcat()) {
>
>             logger.warn("Detected presence of catalina system properties.
> HTTP service will not be started. To enable the GemFire Developer REST API,
> please deploy the /geode-web-api WAR file in your application server.");
>
>         } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
>
>             Map<String, Object> securityServiceAttr = new HashMap<>();
>
>             securityServiceAttr.put(HttpService.
> SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
>
>             if (cache.getOptionalService(HttpService.class).isPresent()) {
>
>                 HttpService httpService = cache.getOptionalService(
> HttpService.class).get();
>
>                 Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
>
>                 httpService.addWebApplication("/gemfire-api",
> gemfireAPIWarPath, securityServiceAttr);
>
>                 httpService.addWebApplication("/geode", gemfireAPIWarPath,
> securityServiceAttr);
>
>             } else {
>
>                 logger.warn("HttpService is not available - could not
> start Dev REST API");
>
>             }
>
>
>
> Is this any help?
>
>
>
> cheers
>
>
>
> *From:* Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
> *Sent:* 14 February 2021 09:44
> *To:* user@geode.apache.org
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
>
>
> *This email has reached the company via an external source. *
>
> *Please be cautious opening any attachments or links. *
>
>
> Hi Aashish,
>
>
>
> Thank you for coming back. I got the same result after setting GEODE_HOME.
> Here are the logs. Any idea what could cause this issue?
>
>
>
> 2021-02-14 15:12:31.426  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
> 2021-02-14 15:12:31.428  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-14 15:12:31.429  WARN 9976 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Thanks,
>
> Pratibha
>
>
>
> On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <
> aashish.choudhary1@gmail.com> wrote:
>
> For some reason your GEODE_HOME is null and it might be causing this
> issue. Please check that first.
>
> With best regards,
> Ashish
>
>
>
> On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>
> wrote:
>
>
>
> Hi Geode Team,
>
>
>
> I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
> and I am having trouble starting up the REST API. Could you please help me
> understand what I am missing here.
>
>
>
> We start up the locator using gfsh and use a spring data geode project to
> start the server. Attached are the geode.properties file used to start the
> locator and the project used to start the server.
>
>
>
> Following are the commands and the JVM arguments used for the locator and
> server respectively. I have also attached the logs from the server that
> does not seem to indicate the reason why the swagger API is not started.
>
>
>
> SpringBoot version - 2.3.0.RELEASE
>
>
>
> Locator start command
>
> start locator --name=Locator1 --port=10334
> --properties-file=D:\apache-geode-1.12.0\geode-locator.properties
>
>
>
> JVM arguments used while starting server
>
> -Dgemfire.home=D:\apache-geode-1.12.0
>
>
>
> Line in the logs that show the API is not available -
>
> 2021-02-04 10:53:05.983  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-04 10:53:05.984  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> D:\apache-geode-1.12.0
> 2021-02-04 10:53:05.985  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-04 10:53:05.986  WARN 8936 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Appreciate any help I can get.
>
>
>
> Thank you,
>
> Pratibha Ayengar
>
>
>
>

Re: Apache geode 1.12.0 swagger UI issue

Posted by Jens Deppe <jd...@vmware.com>.
Hi Pratibha,

In order to start the Developer REST API (which also exposes the Swagger UI) you must set the following properties when you start the server:

start-dev-rest-api=true

In order to do this from gfsh you should use the following option: --J=-Dgemfire.start-dev-rest-api=true. Or if you have a gemfire.properties file then just add the property (without the “gemfire.” prefix). In the server log you should see the following lines indicating the correct startup of the Dev REST API:

[info 2021/02/16 06:32:45.144 PST server1 <main> tid=0x1] GEODE_HOME:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode

[info 2021/02/16 06:32:45.146 PST server1 <main> tid=0x1] Located war: geode-web-api at location: file:/Users/jdeppe/workspace/gemfire-develop/open/geode-assembly/build/install/apache-geode/tools/Extensions/geode-web-api-1.14.0-build.0.war

[info 2021/02/16 06:32:45.214 PST server1 <main> tid=0x1] Adding webapp /gemfire-api

[info 2021/02/16 06:32:45.215 PST server1 <main> tid=0x1] Attempting to start HTTP service on port (7171) at bind-address (0.0.0.0)...

[info 2021/02/16 06:32:46.031 PST server1 <main> tid=0x1] Initializing Servlet 'geode'

[info 2021/02/16 06:32:47.064 PST server1 <main> tid=0x1] Bean 'util:constant#45dc7be' of type [org.springframework.beans.factory.config.FieldRetrievingFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

In the above example I had also set: --J=-Dgemfire.http-service-port=7171 (the default is normally 7070).

Also, the Swagger UI is only available from servers and is not available on the locator.

Hope this helps.
--Jens

From: Pratibha Ayengar <pr...@gmail.com>
Reply-To: "user@geode.apache.org" <us...@geode.apache.org>
Date: Monday, February 15, 2021 at 8:52 PM
To: "user@geode.apache.org" <us...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue

Thank you, Rupert. This does help narrow it down. Would you be able to help on what this particular check is - if (cache.getOptionalService(HttpService.class).isPresent())
This is the one that seems to be failing.

Thanks,
Pratibha


On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <ru...@impress-solutions.com>> wrote:
// Check if we're already running inside Tomcat
        if (isRunningInTomcat()) {
            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
            Map<String, Object> securityServiceAttr = new HashMap<>();
            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
            if (cache.getOptionalService(HttpService.class).isPresent()) {
                HttpService httpService = cache.getOptionalService(HttpService.class).get();
                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);
                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);
            } else {
                logger.warn("HttpService is not available - could not start Dev REST API");
            }

Is this any help?

cheers

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com<ma...@gmail.com>]
Sent: 14 February 2021 09:44
To: user@geode.apache.org<ma...@geode.apache.org>
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:
For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.
With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar


Re: Apache geode 1.12.0 swagger UI issue

Posted by Pratibha Ayengar <pr...@gmail.com>.
Thank you, Rupert. This does help narrow it down. Would you be able to help
on what this particular check is - if (cache.getOptionalService(HttpService.
class).isPresent())
This is the one that seems to be failing.

Thanks,
Pratibha


On Mon, Feb 15, 2021 at 3:04 PM Rupert St John Webster <
rupert.stjohnwebster@impress-solutions.com> wrote:

> // Check if we're already running inside Tomcat
>
>         if (isRunningInTomcat()) {
>
>             logger.warn("Detected presence of catalina system properties.
> HTTP service will not be started. To enable the GemFire Developer REST API,
> please deploy the /geode-web-api WAR file in your application server.");
>
>         } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
>
>             Map<String, Object> securityServiceAttr = new HashMap<>();
>
>             securityServiceAttr.put(HttpService.
> SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
>
>             if (cache.getOptionalService(HttpService.class).isPresent()) {
>
>                 HttpService httpService = cache.getOptionalService(
> HttpService.class).get();
>
>                 Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
>
>                 httpService.addWebApplication("/gemfire-api",
> gemfireAPIWarPath, securityServiceAttr);
>
>                 httpService.addWebApplication("/geode", gemfireAPIWarPath,
> securityServiceAttr);
>
>             } else {
>
>                 logger.warn("HttpService is not available - could not
> start Dev REST API");
>
>             }
>
>
>
> Is this any help?
>
>
>
> cheers
>
>
>
> *From:* Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
> *Sent:* 14 February 2021 09:44
> *To:* user@geode.apache.org
> *Subject:* Re: Apache geode 1.12.0 swagger UI issue
>
>
>
> *This email has reached the company via an external source. *
>
> *Please be cautious opening any attachments or links. *
>
>
> Hi Aashish,
>
>
>
> Thank you for coming back. I got the same result after setting GEODE_HOME.
> Here are the logs. Any idea what could cause this issue?
>
>
>
> 2021-02-14 15:12:31.426  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
> 2021-02-14 15:12:31.428  INFO 9976 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-14 15:12:31.429  WARN 9976 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Thanks,
>
> Pratibha
>
>
>
> On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <
> aashish.choudhary1@gmail.com> wrote:
>
> For some reason your GEODE_HOME is null and it might be causing this
> issue. Please check that first.
>
> With best regards,
> Ashish
>
>
>
> On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>
> wrote:
>
>
>
> Hi Geode Team,
>
>
>
> I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
> and I am having trouble starting up the REST API. Could you please help me
> understand what I am missing here.
>
>
>
> We start up the locator using gfsh and use a spring data geode project to
> start the server. Attached are the geode.properties file used to start the
> locator and the project used to start the server.
>
>
>
> Following are the commands and the JVM arguments used for the locator and
> server respectively. I have also attached the logs from the server that
> does not seem to indicate the reason why the swagger API is not started.
>
>
>
> SpringBoot version - 2.3.0.RELEASE
>
>
>
> Locator start command
>
> start locator --name=Locator1 --port=10334
> --properties-file=D:\apache-geode-1.12.0\geode-locator.properties
>
>
>
> JVM arguments used while starting server
>
> -Dgemfire.home=D:\apache-geode-1.12.0
>
>
>
> Line in the logs that show the API is not available -
>
> 2021-02-04 10:53:05.983  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-04 10:53:05.984  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> D:\apache-geode-1.12.0
> 2021-02-04 10:53:05.985  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-04 10:53:05.986  WARN 8936 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
>
>
> Appreciate any help I can get.
>
>
>
> Thank you,
>
> Pratibha Ayengar
>
>
>
>

RE: Apache geode 1.12.0 swagger UI issue

Posted by Rupert St John Webster <ru...@impress-solutions.com>.
// Check if we're already running inside Tomcat
        if (isRunningInTomcat()) {
            logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
        } else if (agentUtil.isAnyWarFileAvailable(gemfireAPIWar)) {
            Map<String, Object> securityServiceAttr = new HashMap<>();
            securityServiceAttr.put(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM, securityService);
            if (cache.getOptionalService(HttpService.class).isPresent()) {
                HttpService httpService = cache.getOptionalService(HttpService.class).get();
                Path gemfireAPIWarPath = Paths.get(gemfireAPIWar);
                httpService.addWebApplication("/gemfire-api", gemfireAPIWarPath, securityServiceAttr);
                httpService.addWebApplication("/geode", gemfireAPIWarPath, securityServiceAttr);
            } else {
                logger.warn("HttpService is not available - could not start Dev REST API");
            }

Is this any help?

cheers

From: Pratibha Ayengar [mailto:pratibha.ayengar@gmail.com]
Sent: 14 February 2021 09:44
To: user@geode.apache.org
Subject: Re: Apache geode 1.12.0 swagger UI issue


This email has reached the company via an external source.

Please be cautious opening any attachments or links.

Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME. Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <aa...@gmail.com>> wrote:
For some reason your GEODE_HOME is null and it might be causing this issue. Please check that first.
With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>> wrote:

Hi Geode Team,

I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project and I am having trouble starting up the REST API. Could you please help me understand what I am missing here.

We start up the locator using gfsh and use a spring data geode project to start the server. Attached are the geode.properties file used to start the locator and the project used to start the server.

Following are the commands and the JVM arguments used for the locator and server respectively. I have also attached the logs from the server that does not seem to indicate the reason why the swagger API is not started.

SpringBoot version - 2.3.0.RELEASE

Locator start command
start locator --name=Locator1 --port=10334 --properties-file=D:\apache-geode-1.12.0\geode-locator.properties

JVM arguments used while starting server
-Dgemfire.home=D:\apache-geode-1.12.0

Line in the logs that show the API is not available -
2021-02-04 10:53:05.983  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
2021-02-04 10:53:05.984  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System Property -> D:\apache-geode-1.12.0
2021-02-04 10:53:05.985  INFO 8936 --- [           main] o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at location: file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-04 10:53:05.986  WARN 8936 --- [           main] o.a.geode.management.internal.RestAgent  : HttpService is not available - could not start Dev REST API

Appreciate any help I can get.

Thank you,
Pratibha Ayengar


Re: Apache geode 1.12.0 swagger UI issue

Posted by Pratibha Ayengar <pr...@gmail.com>.
Hi Aashish,

Thank you for coming back. I got the same result after setting GEODE_HOME.
Here are the logs. Any idea what could cause this issue?

2021-02-14 15:12:31.426  INFO 9976 --- [           main]
o.a.geode.management.internal.AgentUtil  : GEODE_HOME:D:\apache-geode-1.12.0
2021-02-14 15:12:31.428  INFO 9976 --- [           main]
o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
location:
file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
2021-02-14 15:12:31.429  WARN 9976 --- [           main]
o.a.geode.management.internal.RestAgent  : HttpService is not available -
could not start Dev REST API

Thanks,
Pratibha

On Sat, Feb 13, 2021 at 5:57 PM Ashish Choudhary <
aashish.choudhary1@gmail.com> wrote:

> For some reason your GEODE_HOME is null and it might be causing this
> issue. Please check that first.
>
> With best regards,
> Ashish
>
> On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>
> wrote:
>
>>
>> Hi Geode Team,
>>
>> I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
>> and I am having trouble starting up the REST API. Could you please help me
>> understand what I am missing here.
>>
>> We start up the locator using gfsh and use a spring data geode project to
>> start the server. Attached are the geode.properties file used to start the
>> locator and the project used to start the server.
>>
>> Following are the commands and the JVM arguments used for the locator and
>> server respectively. I have also attached the logs from the server that
>> does not seem to indicate the reason why the swagger API is not started.
>>
>> SpringBoot version - 2.3.0.RELEASE
>>
>> Locator start command
>> start locator --name=Locator1 --port=10334
>> --properties-file=D:\apache-geode-1.12.0\geode-locator.properties
>>
>> JVM arguments used while starting server
>> -Dgemfire.home=D:\apache-geode-1.12.0
>>
>> Line in the logs that show the API is not available -
>> 2021-02-04 10:53:05.983  INFO 8936 --- [           main]
>> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
>> 2021-02-04 10:53:05.984  INFO 8936 --- [           main]
>> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
>> Property -> D:\apache-geode-1.12.0
>> 2021-02-04 10:53:05.985  INFO 8936 --- [           main]
>> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
>> location:
>> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
>> 2021-02-04 10:53:05.986  WARN 8936 --- [           main]
>> o.a.geode.management.internal.RestAgent  : HttpService is not available -
>> could not start Dev REST API
>>
>> Appreciate any help I can get.
>>
>> Thank you,
>> Pratibha Ayengar
>>
>>

Re: Apache geode 1.12.0 swagger UI issue

Posted by Ashish Choudhary <aa...@gmail.com>.
For some reason your GEODE_HOME is null and it might be causing this issue.
Please check that first.

With best regards,
Ashish

On Sat, Feb 13, 2021, 4:56 PM Pratibha Ayengar <pr...@gmail.com>
wrote:

>
> Hi Geode Team,
>
> I am upgrading apache geode version from 1.6.0 to 1.12.0 for our project
> and I am having trouble starting up the REST API. Could you please help me
> understand what I am missing here.
>
> We start up the locator using gfsh and use a spring data geode project to
> start the server. Attached are the geode.properties file used to start the
> locator and the project used to start the server.
>
> Following are the commands and the JVM arguments used for the locator and
> server respectively. I have also attached the logs from the server that
> does not seem to indicate the reason why the swagger API is not started.
>
> SpringBoot version - 2.3.0.RELEASE
>
> Locator start command
> start locator --name=Locator1 --port=10334
> --properties-file=D:\apache-geode-1.12.0\geode-locator.properties
>
> JVM arguments used while starting server
> -Dgemfire.home=D:\apache-geode-1.12.0
>
> Line in the logs that show the API is not available -
> 2021-02-04 10:53:05.983  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : GEODE_HOME:null
> 2021-02-04 10:53:05.984  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Reading gemfire.home System
> Property -> D:\apache-geode-1.12.0
> 2021-02-04 10:53:05.985  INFO 8936 --- [           main]
> o.a.geode.management.internal.AgentUtil  : Located war: geode-web-api at
> location:
> file:/D:/apache-geode-1.12.0/tools/Extensions/geode-web-api-1.12.0.war
> 2021-02-04 10:53:05.986  WARN 8936 --- [           main]
> o.a.geode.management.internal.RestAgent  : HttpService is not available -
> could not start Dev REST API
>
> Appreciate any help I can get.
>
> Thank you,
> Pratibha Ayengar
>
>