2 java web applications using the same node in local mode

I have 2 web applications running in the same JVM. The first one manage the
index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();*
Client client = node.client();*
The first web application invoking this code will get access to the client
while the second one will hang for a while and then loop indefinitly. I got
this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks

Perhaps your webapps share the same path for datas ?
Did you set up path.data for each node ?

Not sure that is your problem.

HTH
David :wink:

Le 14 sept. 2011 à 02:54, Carl Samson samsoncarl@gmail.com a écrit :

I have 2 web applications running in the same JVM. The first one manage the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();
Client client = node.client();
The first web application invoking this code will get access to the client while the second one will hang for a while and then loop indefinitly. I got this error

   at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj

ectorBuilder.java:182)

    at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder

.java:114)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same node from both web app. I am using version 0.17.0

Thanks

I don't see the exception message with what you pasted (and can you please
gist it)?

The way local node works is that it does static level discovery of nodes
(static in the level of the same classloader). Your code will basically
start two instances of the node, which if started in a single class loader,
it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way to
share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson samsoncarl@gmail.com wrote:

I have 2 web applications running in the same JVM. The first one manage the
index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();*
Client client = node.client();*
The first web application invoking this code will get access to the
client while the second one will hang for a while and then loop indefinitly.
I got this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks

Yes i need to create to node instance sharing the same data (one web app
writes and the other one reads)

It seems there is a lock exception, any way for me that i could use that
configuration ?

Here is the exception

org.elasticsearch.common.inject.CreationException: Guice creation errors:

  1. Error injecting constructor,
    java.nio.channels.OverlappingFileLockException

at org.elasticsearch.env.NodeEnvironment.(Unknown Source)

while locating org.elasticsearch.env.NodeEnvironment

Caused by: java.nio.channels.OverlappingFileLockException

at
sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1166)

at
sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1068)

at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:868)

at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)

at org.apache.lucene.store.NativeFSLock.obtain(NativeFSLockFactory.java:216)

at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:69)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at
org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)

at
org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)

at
org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:103)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)

at
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:823)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)

at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)

at
org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:49)

at
org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:204)

at
org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:197)

at
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:816)

at
org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:197)

at
org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:179)

at
org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:114)

at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)

at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)

at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:58)

at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java:147)

at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)

at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

at com.personalization.utils.SearchClient.initClient(SearchClient.java:91)

at com.personalization.utils.SearchClient.getClient(SearchClient.java:41)

at
com.personalization.services.search.impl.SearchServiceImpl.searchAutocomplete(SearchServiceImpl.java:517)

at
com.personalization.services.search.worker.KeywordSearchWorkerImpl.execute(KeywordSearchWorkerImpl.java:17)

at
com.personalization.services.search.workflow.SearchWorkflow.searchAutocomplete(SearchWorkflow.java:51)

at
com.personalization.services.search.SearchService.searchAutoComplete(SearchService.java:198)

at
com.personalization.search.SearchControler.autocomplete(SearchControler.java:60)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:185)

at
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)

at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)

at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:502)

at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:465)

at
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:863)

at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)

at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:851)

at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:767)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at
org.springframework.mvc.extensions.flash.FlashMapFilter.doFilterInternal(FlashMapFilter.java:33)

at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Thread.java:662)

  1. Error injecting constructor,
    java.nio.channels.OverlappingFileLockException

at org.elasticsearch.env.NodeEnvironment.(Unknown Source)

while locating org.elasticsearch.env.NodeEnvironment

for parameter 1 at
org.elasticsearch.indices.InternalIndicesService.(Unknown Source)

while locating org.elasticsearch.indices.InternalIndicesService

while locating org.elasticsearch.indices.IndicesService

for parameter 4 at
org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.(Unknown
Source)

while locating org.elasticsearch.cluster.metadata.MetaDataCreateIndexService

Caused by: java.nio.channels.OverlappingFileLockException

at
sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1166)

at
sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1068)

at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:868)

at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)

at org.apache.lucene.store.NativeFSLock.obtain(NativeFSLockFactory.java:216)

at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:69)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at
org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)

at
org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)

at
org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:103)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)

at
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:823)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)

at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)

at
org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:49)

at
org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)

at
org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)

at
org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)

at
org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:103)

at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:56)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)

at
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:823)

at
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)

at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)

at
org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:49)

at
org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterIn...

On Wed, Sep 14, 2011 at 4:01 AM, Shay Banon kimchy@gmail.com wrote:

I don't see the exception message with what you pasted (and can you please
gist it)?

The way local node works is that it does static level discovery of nodes
(static in the level of the same classloader). Your code will basically
start two instances of the node, which if started in a single class loader,
it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way to
share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson samsoncarl@gmail.com wrote:

I have 2 web applications running in the same JVM. The first one manage
the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();*

Client client = node.client();*
The first web application invoking this code will get access to the client
while the second one will hang for a while and then loop indefinitly. I got
this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks

I found my issue to be the same as this one. Any idea on a workaround ?

http://elasticsearch-users.115913.n3.nabble.com/QA-Infinite-loop-when-catching-failure-due-to-file-path-error-td2984771.html

On Wed, Sep 14, 2011 at 4:01 AM, Shay Banon kimchy@gmail.com wrote:

I don't see the exception message with what you pasted (and can you please
gist it)?

The way local node works is that it does static level discovery of nodes
(static in the level of the same classloader). Your code will basically
start two instances of the node, which if started in a single class loader,
it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way to
share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson samsoncarl@gmail.com wrote:

I have 2 web applications running in the same JVM. The first one manage
the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();*

Client client = node.client();*
The first web application invoking this code will get access to the client
while the second one will hang for a while and then loop indefinitly. I got
this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks

You will create two instances of the Node, thats not what you want. You need
to somehow share the same instance between the two web apps. Even if you
did manage to start two instances, you will have two instances ... .

On Thu, Sep 15, 2011 at 3:47 AM, Carl Samson samsoncarl@gmail.com wrote:

I found my issue to be the same as this one. Any idea on a workaround ?

http://elasticsearch-users.115913.n3.nabble.com/QA-Infinite-loop-when-catching-failure-due-to-file-path-error-td2984771.html

On Wed, Sep 14, 2011 at 4:01 AM, Shay Banon kimchy@gmail.com wrote:

I don't see the exception message with what you pasted (and can you please
gist it)?

The way local node works is that it does static level discovery of nodes
(static in the level of the same classloader). Your code will basically
start two instances of the node, which if started in a single class loader,
it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way
to share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson samsoncarl@gmail.comwrote:

I have 2 web applications running in the same JVM. The first one manage
the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();
*
Client client = node.client();*
The first web application invoking this code will get access to the
client while the second one will hang for a while and then loop indefinitly.
I got this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks

Yes there are 2 instances trying to share the same data (what i wanted) but netty locks the files for the first client who get access to the files. I have to start a new node seperatly and use transport client from my 2 web apps.

Any way to avoid those file lock so 2 instances can share the same data ?

Thanks

Sent from my iPhone

On 2011-09-15, at 5:37 AM, Shay Banon kimchy@gmail.com wrote:

You will create two instances of the Node, thats not what you want. You need to somehow share the same instance between the two web apps. Even if you did manage to start two instances, you will have two instances ... .

On Thu, Sep 15, 2011 at 3:47 AM, Carl Samson samsoncarl@gmail.com wrote:
I found my issue to be the same as this one. Any idea on a workaround ?

http://elasticsearch-users.115913.n3.nabble.com/QA-Infinite-loop-when-catching-failure-due-to-file-path-error-td2984771.html

On Wed, Sep 14, 2011 at 4:01 AM, Shay Banon kimchy@gmail.com wrote:
I don't see the exception message with what you pasted (and can you please gist it)?

The way local node works is that it does static level discovery of nodes (static in the level of the same classloader). Your code will basically start two instances of the node, which if started in a single class loader, it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way to share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson samsoncarl@gmail.com wrote:
I have 2 web applications running in the same JVM. The first one manage the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();
Client client = node.client();
The first web application invoking this code will get access to the client while the second one will hang for a while and then loop indefinitly. I got this error

   at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj

ectorBuilder.java:182)

    at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder

.java:114)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same node from both web app. I am using version 0.17.0

Thanks

You can't have two instances that share the same data directory (its not
netty that locks the directory). You either start one, and talk to the
second one (can't use local nodes in this case), or somehow share the same
instance across both webapps.

On Thu, Sep 15, 2011 at 4:21 PM, Carl Samson - GMail
samsoncarl@gmail.comwrote:

Yes there are 2 instances trying to share the same data (what i wanted) but
netty locks the files for the first client who get access to the files. I
have to start a new node seperatly and use transport client from my 2 web
apps.

Any way to avoid those file lock so 2 instances can share the same data ?

Thanks

Sent from my iPhone

On 2011-09-15, at 5:37 AM, Shay Banon kimchy@gmail.com wrote:

You will create two instances of the Node, thats not what you want. You
need to somehow share the same instance between the two web apps. Even if
you did manage to start two instances, you will have two instances ... .

On Thu, Sep 15, 2011 at 3:47 AM, Carl Samson < samsoncarl@gmail.com
samsoncarl@gmail.com> wrote:

I found my issue to be the same as this one. Any idea on a workaround ?

http://elasticsearch-users.115913.n3.nabble.com/QA-Infinite-loop-when-catching-failure-due-to-file-path-error-td2984771.html
http://elasticsearch-users.115913.n3.nabble.com/QA-Infinite-loop-when-catching-failure-due-to-file-path-error-td2984771.html

On Wed, Sep 14, 2011 at 4:01 AM, Shay Banon < kimchy@gmail.com
kimchy@gmail.com> wrote:

I don't see the exception message with what you pasted (and can you
please gist it)?

The way local node works is that it does static level discovery of nodes
(static in the level of the same classloader). Your code will basically
start two instances of the node, which if started in a single class loader,
it will form a two node cluster.

If you want a single node, that is still local, make sure you find a way
to share the same Node and Client between the two web applications.

On Wed, Sep 14, 2011 at 3:54 AM, Carl Samson < samsoncarl@gmail.com
samsoncarl@gmail.com> wrote:

I have 2 web applications running in the same JVM. The first one manage
the index the second one searches the index.
Both web applications use the same node in local mode

Node node = nodeBuilder().clusterName('mycluster').local(true).node();
**
Client client = node.client();

The first web application invoking this code will get access to the
client while the second one will hang for a while and then loop indefinitly.
I got this error

   at

org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(Inj
ectorBuilder.java:182)

    at

org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder
.java:114)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at
org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at
org.elasticsearch.common.inject.ModulesBuilder.createInjector(Modules
Builder.java:58)
at
org.elasticsearch.node.internal.InternalNode.(InternalNode.java
:147)
at
org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Is that a possible configuration ? what would be the way to use the same
node from both web app. I am using version 0.17.0

Thanks