在 Pivotal GemFire Lucene Analyzer 中访问数据未找到

Accessing Data in Pivotal GemFire Lucene Analyzer not found

我正在关注 https://spring.io/guides/gs/accessing-data-gemfire/。我克隆了它,做了一个 mvn package,然后 java -jar target/gs-accessing-data-gemfire-0.1.0.jar 并得到了这个堆栈跟踪:

[info 2018/07/15 21:55:04.676 BST <main> tid=0x1] Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@76f2b07d: startup date [Sun Jul 15 21:55:04 BST 2018]; root of context hierarchy

[error 2018/07/15 21:55:06.347 BST <main> tid=0x1] java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated

[error 2018/07/15 21:55:06.410 BST <main> tid=0x1] Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'run' defined in hello.Application: Unsatisfied dependency expressed through method 'run' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'People': Cannot resolve reference to bean 'gemfireCache' while setting bean property 'cache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:474)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1256)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1105)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=10=](AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
    at hello.Application.main(Application.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'People': Cannot resolve reference to bean 'gemfireCache' while setting bean property 'cache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:589)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=10=](AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
    ... 26 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'People': Cannot resolve reference to bean 'gemfireCache' while setting bean property 'cache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1611)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1363)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:580)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=10=](AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:515)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:503)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1198)
    at org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean.setApplicationContext(GemfireRepositoryFactoryBean.java:102)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:120)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:96)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:424)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1700)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
    ... 36 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache': FactoryBean threw exception on object creation; nested exception is java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1645)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1184)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:367)
    ... 54 more
Caused by: java.util.ServiceConfigurationError: org.apache.geode.internal.cache.CacheService: Provider org.apache.geode.cache.lucene.internal.LuceneServiceImpl could not be instantiated
    at java.util.ServiceLoader.fail(Unknown Source)
    at java.util.ServiceLoader.access0(Unknown Source)
    at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
    at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
    at java.util.ServiceLoader.next(Unknown Source)
    at org.apache.geode.internal.cache.GemFireCacheImpl.initializeServices(GemFireCacheImpl.java:1228)
    at org.apache.geode.internal.cache.GemFireCacheImpl.initialize(GemFireCacheImpl.java:1185)
    at org.apache.geode.internal.cache.GemFireCacheImpl.basicCreate(GemFireCacheImpl.java:758)
    at org.apache.geode.internal.cache.GemFireCacheImpl.createClient(GemFireCacheImpl.java:731)
    at org.apache.geode.cache.client.ClientCacheFactory.basicCreate(ClientCacheFactory.java:262)
    at org.apache.geode.cache.client.ClientCacheFactory.create(ClientCacheFactory.java:212)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.createCache(ClientCacheFactoryBean.java:400)
    at org.springframework.data.gemfire.CacheFactoryBean.resolveCache(CacheFactoryBean.java:315)
    at org.springframework.data.gemfire.CacheFactoryBean.init(CacheFactoryBean.java:265)
    at java.util.Optional.orElseGet(Unknown Source)
    at org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:760)
    at org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:107)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
    ... 60 more
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    ... 76 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
    at java.net.URLClassLoader.run(Unknown Source)
    at java.net.URLClassLoader.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 80 more
Caused by: java.util.zip.ZipException: invalid stored block lengths
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52)
    at sun.misc.Resource.getBytes(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access0(Unknown Source)`enter code here`
    ... 87 more

我没有更改代码中的任何内容。我只是克隆它并尝试 运行 它。任何人都可以阐明为什么会这样吗?也许 Spring 示例代码是错误的?查看 Eclipse 中的 Maven 依赖项,Analyzer 显然在那里。我尝试删除 .m2 中的罐子,但仍然出现相同的错误。谢谢。

首先,Spring示例代码是正确的。

其次,Eclipse 依赖项与 Spring Boot "executable" JAR 有什么关系?需要注意的重要事项是是否将正确的 JAR 依赖项添加到 Spring Boot "executable" JAR 文件中。

所以,我有一段时间没有看这个 guide/sample,但一切似乎都井井有条。

首先...

$ git fetch --all
Fetching origin
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 17 (delta 10), reused 16 (delta 10), pack-reused 1
Unpacking objects: 100% (17/17), done.
From github.com:spring-guides/gs-accessing-data-gemfire
   037f6d7..e12f231  master     -> origin/master
 * [new tag]         2.0.2.RELEASE -> 2.0.2.RELEASE
 * [new tag]         2.0.3.RELEASE -> 2.0.3.RELEASE

还有...

$ git status
On branch master
Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
nothing to commit, working directory clean

还有...

$ git merge origin/master
Updating 037f6d7..e12f231
Fast-forward
 complete/build.gradle | 6 +++---
 complete/pom.xml      | 2 +-
 initial/build.gradle  | 6 +++---
 initial/pom.xml       | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

然后...

$ mvn clean package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-accessing-data-gemfire 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ gs-accessing-data-gemfire ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ gs-accessing-data-gemfire ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/main/resources
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ gs-accessing-data-gemfire ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ gs-accessing-data-gemfire ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ gs-accessing-data-gemfire ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ gs-accessing-data-gemfire ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ gs-accessing-data-gemfire ---
[INFO] Building jar: /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/target/gs-accessing-data-gemfire-0.1.0.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.0.3.RELEASE:repackage (default) @ gs-accessing-data-gemfire ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.111 s
[INFO] Finished at: 2018-07-16T10:27:55-07:00
[INFO] Final Memory: 36M/340M
[INFO] ------------------------------------------------------------------------

当我检查 Spring 引导可执行 JAR (target/gs-accessing-data-gemfire-0.1.0.jar) 内容时,果然,我看到了 Lucene 依赖项。

$ jar -tvf target/gs-accessing-data-gemfire-0.1.0.jar | less
...
294235 Fri Sep 08 19:46:40 PDT 2017 BOOT-INF/lib/geode-lucene-9.1.1.jar
1493435 Wed Feb 01 14:44:10 PST 2017 BOOT-INF/lib/lucene-analyzers-common-6.4.1.jar
2648855 Wed Feb 01 14:43:32 PST 2017 BOOT-INF/lib/lucene-core-6.4.1.jar
229916 Wed Feb 01 14:44:26 PST 2017 BOOT-INF/lib/lucene-queries-6.4.1.jar
 26143 Wed Feb 01 14:44:12 PST 2017 BOOT-INF/lib/lucene-analyzers-phonetic-6.4.1.jar
335042 Tue Oct 17 08:53:20 PDT 2017 BOOT-INF/lib/commons-codec-1.11.jar
404640 Wed Feb 01 14:44:26 PST 2017 BOOT-INF/lib/lucene-queryparser-6.4.1.jar
192594 Wed Feb 01 14:44:28 PST 2017 BOOT-INF/lib/lucene-sandbox-6.4.1.jar
1
...

因此,当我 运行 Spring Boot,使用 Spring Boot Maven 插件的 Pivotal GemFire 应用程序时,一切都按预期工作...

$ mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-accessing-data-gemfire 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) > test-compile @ gs-accessing-data-gemfire >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ gs-accessing-data-gemfire ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/main/resources
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ gs-accessing-data-gemfire ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ gs-accessing-data-gemfire ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ gs-accessing-data-gemfire ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) < test-compile @ gs-accessing-data-gemfire <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) @ gs-accessing-data-gemfire ---

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

[info 2018/07/16 10:28:44.753 PDT <main> tid=0xb] Starting Application on jblum-mbpro-2.local with PID 88211 (/Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/target/classes started by jblum in /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete)

[info 2018/07/16 10:28:44.755 PDT <main> tid=0xb] No active profile set, falling back to default profiles: default

[info 2018/07/16 10:28:44.805 PDT <main> tid=0xb] Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@69d6e858: startup date [Mon Jul 16 10:28:44 PDT 2018]; root of context hierarchy

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Before accessing data in Pivotal GemFire...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Saving Alice, Bob and Carol to Pivotal GemFire...
Lookup each person by name...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Query adults (over 18):
    Adult Alice is 40 years old
Query babies (less than 5):
    Baby Bob is 1 years old
Query teens (between 12 and 20):
    Teen Carol is 13 years old
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.141 s
[INFO] Finished at: 2018-07-16T10:28:46-07:00
[INFO] Final Memory: 52M/569M
[INFO] ------------------------------------------------------------------------

而且,当我 运行 使用 java -jar 相同的应用程序时,一切 运行 都符合预期,而且...

$ java -jar target/gs-accessing-data-gemfire-0.1.0.jar

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

[info 2018/07/16 10:32:35.136 PDT <main> tid=0x1] Starting Application v0.1.0 on jblum-mbpro-2.local with PID 88232 (/Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete/target/gs-accessing-data-gemfire-0.1.0.jar started by jblum in /Users/jblum/pivdev/spring-gs-guides/gs-accessing-data-gemfire/complete)

[info 2018/07/16 10:32:35.139 PDT <main> tid=0x1] No active profile set, falling back to default profiles: default

[info 2018/07/16 10:32:35.214 PDT <main> tid=0x1] Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6ee52dcd: startup date [Mon Jul 16 10:32:35 PDT 2018]; root of context hierarchy

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Before accessing data in Pivotal GemFire...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Saving Alice, Bob and Carol to Pivotal GemFire...
Lookup each person by name...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Query adults (over 18):
    Adult Alice is 40 years old
Query babies (less than 5):
    Baby Bob is 1 years old
Query teens (between 12 and 20):
    Teen Carol is 13 years old

当我构建 运行 和 Gradle 时,相同的应用程序工作...

$ gradlew clean build

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
3 actionable tasks: 3 executed

$ ll build/libs/
total 122648
-rw-r--r--  1 jblum  staff  62792971 Jul 16 10:34 gs-accessing-data-gemfire-0.1.0.jar

$ jar -tvf build/libs/gs-accessing-data-gemfire-0.1.0.jar | less

$ gradlew bootRun

> Task :bootRun 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

Before accessing data in Pivotal GemFire...
        Adult Alice is 40 years old
        Baby Bob is 1 years old
        Teen Carol is 13 years old
Saving Alice, Bob and Carol to Pivotal GemFire...
Lookup each person by name...
        Adult Alice is 40 years old
        Baby Bob is 1 years old
        Teen Carol is 13 years old
Query adults (over 18):
        Adult Alice is 40 years old
Query babies (less than 5):
        Baby Bob is 1 years old
Query teens (between 12 and 20):
        Teen Carol is 13 years old


Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
2 actionable tasks: 1 executed, 1 up-to-date

$ java -jar build/libs/gs-accessing-data-gemfire-0.1.0.jar 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

Before accessing data in Pivotal GemFire...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Saving Alice, Bob and Carol to Pivotal GemFire...
Lookup each person by name...
    Adult Alice is 40 years old
    Baby Bob is 1 years old
    Teen Carol is 13 years old
Query adults (over 18):
    Adult Alice is 40 years old
Query babies (less than 5):
    Baby Bob is 1 years old
Query teens (between 12 and 20):
    Teen Carol is 13 years old

也许,检查您是否已更新此应用程序(即 git pull)并验证版本是 Spring Boot 2.0.3.RELEASE 和 Spring Data GemFire 2.0.8.RELEASE, 分别.

谢谢!