Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-6154

Spring-shell is not an optional dependency if you create a Cache in an application

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • core, jmx

    Description

      The geode-core pom should be considered the pom for Geode Cache, not Geode Client Cache. If we want to have a separate module for clients which leaves out certain dependencies then that would be one approach. Moving GFSH and the spring-shell dependent code to another Geode module would also be another approach that works. But simply crippling a pom so that one of the main uses of Geode does not work out of box is a big no-no.

      Creating a Cache in an application using maven dependencies (geode-core specifically) is supported but broken because we flag spring-shell as optional.

      A User who creates a Cache in an application should not be forced to either have JMX broken or explicitly add in spring-shell to their application's dependencies.

      10:31:55.168 [main] WARN  o.a.g.d.i.InternalDistributedSystem - org/springframework/shell/core/Parser
      java.lang.NoClassDefFoundError: org/springframework/shell/core/Parser
      	at org.apache.geode.management.internal.beans.MemberMBeanBridge.<init>(MemberMBeanBridge.java:333)
      	at org.apache.geode.management.internal.beans.ManagementAdapter.handleCacheCreation(ManagementAdapter.java:144)
      	at org.apache.geode.management.internal.beans.ManagementListener.handleEvent(ManagementListener.java:115)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.notifyResourceEventListeners(InternalDistributedSystem.java:2201)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.handleResourceEvent(InternalDistributedSystem.java:606)
      	at org.apache.geode.internal.cache.GemFireCacheImpl.initialize(GemFireCacheImpl.java:1214)
      	at org.apache.geode.internal.cache.GemFireCacheImpl.basicCreate(GemFireCacheImpl.java:799)
      	at org.apache.geode.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:785)
      	at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:176)
      	at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:223)
      	at io.github.kirklund.geode.GeodeApplicationIntegrationTest.setUp(GeodeApplicationIntegrationTest.java:35)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: java.lang.ClassNotFoundException: org.springframework.shell.core.Parser
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	... 34 common frames omitted
      

      You can reproduce this bug by specifying geode-core as a dependency in maven:

              <dependency>
                  <groupId>org.apache.geode</groupId>
                  <artifactId>geode-core</artifactId>
                  <version>1.9.0-SNAPSHOT</version>
              </dependency>
      

      And then create a Cache:

          cache = new CacheFactory().set(LOCATORS, "").create();
      

      You will see the above warning get logged and Geode JMX will be broken.

      Attachments

        Issue Links

          Activity

            People

              klund Kirk Lund
              klund Kirk Lund
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m