SathiyaS
SathiyaS

Reputation: 246

Spring XD - Test failures

I took the latest copy of XD source from github and tried building local. When I run the build task, the below errors comes up. I am running Redis on port 6379. Not sure if anything else is missing.

my /etc/hosts seems to look fine in the Mac. I had to do a -x test to skip the tests. Any possible resolution? Should I be running gemfire?

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 imac

13:49:47.920 [DEBUG] [TestEventLogger] 
13:49:47.920 [DEBUG] [TestEventLogger] org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests > test FAILED
13:49:47.921 [DEBUG] [TestEventLogger]     java.lang.RuntimeException: java.net.UnknownHostException
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.initAddress(DirectChannel.java:902)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.<init>(DirectChannel.java:126)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.jgroup.JGroupMembershipManager.<init>(JGroupMembershipManager.java:1575)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.jgroup.JGroupMemberFactory.newMembershipManager(JGroupMemberFactory.java:111)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.MemberFactory.newMembershipManager(MemberFactory.java:95)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.<init>(DistributionManager.java:1180)
13:49:47.921 [INFO] [system.out] 13:49:47.921 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.<init>(DistributionManager.java:1238)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.create(DistributionManager.java:613)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.initialize(InternalDistributedSystem.java:515)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:230)
13:49:47.922 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.DistributedSystem.connect(DistributedSystem.java:1105)
13:49:47.922 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:227)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests.test(JsonStringToObjectTransformerTests.java:31)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.922 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.924 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
13:49:47.925 [DEBUG] [TestEventLogger]         at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
13:49:47.926 [DEBUG] [TestEventLogger]         at java.lang.Thread.run(Thread.java:745)
13:49:47.926 [DEBUG] [TestEventLogger] 
13:49:47.926 [DEBUG] [TestEventLogger]         Caused by:
13:49:47.926 [DEBUG] [TestEventLogger]         java.net.UnknownHostException
13:49:47.926 [DEBUG] [TestEventLogger]             at com.gemstone.gemfire.internal.SocketCreator.getLocalHost(SocketCreator.java:312)
13:49:47.926 [DEBUG] [TestEventLogger]             at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.initAddress(DirectChannel.java:898)
13:49:47.926 [DEBUG] [TestEventLogger]             ... 54 more
13:49:47.928 [DEBUG] [TestEventLogger] 
13:49:47.928 [DEBUG] [TestEventLogger] org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests FAILED
13:49:47.928 [DEBUG] [TestEventLogger] 
13:49:47.928 [DEBUG] [TestEventLogger] Gradle Test Executor 6 FAILED

Upvotes: 0

Views: 158

Answers (2)

John Blum
John Blum

Reputation: 7991

Agreed, your /etc/hosts file appears to be fine (though, I would format it so each host entry is on a single line).

Seems you might running GemFire 7?

Also, what Java vendor/version are you running on your Mac (Apple or Oracle JDK/JRE and version)?

Your version of Mac OS X maybe a factor(???), especially if you have disabled networking (i.e. no "active" NIC, connected with a valid IP, as determined by ifconfig), though this is less than clear.

In a nutshell, GemFire attempts to resolve/lookup the actual IP address of the local system (using GemFire's internal SocketCreator class) when the loopback address is only IP specified (as in your /etc/hosts file), or as returned by InetAddress.getLocalHost().

This resolution process is rather involved and is unfortunately contained within a "static initializer" block inside the SocketCreator class, when the class is loaded.

It seems unlikely that InetAddress.getLocalHost() would ever return null, but in this case the reason why the UnknownHostException in GemFire was thrown was because the SocketCreator.localHost class member variable was null...

310:  public static InetAddress getLocalHost() throws UnknownHostException {
311:    if (localHost == null) {
312:      throw new UnknownHostException();
313:    }
314:    return localHost;
315:  }

The "SocketCreator.localHost" static member variable is initialized inside the static initializer block.

So, either the static initializer was not called or InetAddress.getLocalHost() (possibly because networking was disabled?) returned null, though looking through GemFire's code that would have led to a NullPointerException (that I am uncertain whether might have gotten swallowed somewhere), so it seems more along the lines of the former, but neither answer seems likely, really.

One possible workaround (as it avoided this IP resolution step on startup of GemFire's Membership, as is seen in the stack trace) would be to modify the Spring XD test class, JsonStringToObjectTransformerTests, on line 31, to be...

31:    new CacheFactory().set("mcast-port", "0").set("log-level", "warning").create();

This avoided the SocketCreator.getLocalHost() call from DirectChannel.initAddress(DirectChannel.java:898).

Also, setting the log-level to warn reduces the GemFire noise and significantly speeds up the test.

Hope this helps.

Upvotes: 0

dturanski
dturanski

Reputation: 1723

A weird one. I agree, your /etc/hosts looks good. I have seen this on Linux boxes that sometimes use 127.0.1.1 instead of 127.0.0.1. The test simply starts a cache with new CacheFactory().create(); If you are a GemFire user, you might want to check if you have any gemfire.properties or cache.xml files lying around in your home directory, current directory, or classpath. GemFire is notorious for finding those.

Upvotes: 1

Related Questions