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.ayen...@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 <jde...@vmware.com<mailto:jde...@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 <pratibha.ayen...@gmail.com<mailto:pratibha.ayen...@gmail.com>> Reply-To: "user@geode.apache.org<mailto:user@geode.apache.org>" <user@geode.apache.org<mailto:user@geode.apache.org>> Date: Monday, February 15, 2021 at 8:52 PM To: "user@geode.apache.org<mailto:user@geode.apache.org>" <user@geode.apache.org<mailto:user@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.stjohnwebs...@impress-solutions.com<mailto:rupert.stjohnwebs...@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.ayen...@gmail.com<mailto:pratibha.ayen...@gmail.com>] Sent: 14 February 2021 09:44 To: user@geode.apache.org<mailto: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.choudha...@gmail.com<mailto:aashish.choudha...@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 <pratibha.ayen...@gmail.com<mailto:pratibha.ayen...@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