Project: springxd
Issue XD-2856: deploy-working-dir is set to to root directory when container is started as service
When Spring XD is started as a service using {{service spring-xd-container start}} the deploy-working-dir in GemFire module is resolved to the top-most directory (on Linux "/"). This directory is not writable by spring-xd user under which the process is executed. When a stream using GemFire is created e.g. {{stream create --name gfTest --definition "time | gemfire-json-server ...}} following exception will be thrown: {code} [error 2015/03/24 15:55:20.798 GMT tid=0x34] Error when attempting to deploy JAR files on load. java.io.IOException: Unable to write to deploy directory com.gemstone.gemfire.internal.JarDeployer.verifyWritableDeployDirectory(JarDeployer.java:589) com.gemstone.gemfire.internal.JarDeployer.loadPreviouslyDeployedJars(JarDeployer.java:68) com.gemstone.gemfire.internal.cache.GemFireCacheImpl.init(GemFireCacheImpl.java:839) com.gemstone.gemfire.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:620) com.gemstone.gemfire.cache.client.ClientCacheFactory.basicCreate(ClientCacheFactory.java:207) com.gemstone.gemfire.cache.client.ClientCacheFactory.create(ClientCacheFactory.java:162) org.springframework.data.gemfire.client.ClientCacheFactoryBean.createCache(ClientCacheFactoryBean.java:93) org.springframework.data.gemfire.CacheFactoryBean.init(CacheFactoryBean.java:271) org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:455) org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:77) org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:743) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) org.springframework.boot.SpringApplication.run(SpringApplication.java:321) org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:214) org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217) org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200) org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363) org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332) org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179) org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147) org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503) org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83) org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500) org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask.run(FutureTask.java:262) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask.run(FutureTask.java:262) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:745) {code} deploy-working-dir should be set to a directory which writable by spring-xd user (maybe java.io.tmpdir?).
Story points: 1