Hi Joerge,

I have overridden Spring ContextLoadListener and tried to close the client 
instance on context destroyed, but i still get the same error.


MyAppContextLoadListener 
 @Override
 public void contextInitialized(ServletContextEvent event) {
   super.contextInitialized(event);
   log.debug("My web app  Loaded.......");
 
// You can get Servelte Context 
   ServletContext servletContect = event.getServletContext();
 
   WebApplicationContext webApplicationContext = 
WebApplicationContextUtils.getRequiredWebApplicationContext(servletContect);
 
// You can get any bean, which is defined in spring xml file here.
   ESClient esclient = ESClient.getInstance();
   client = esclient.getClient();
 }
 
    @Override
    public void contextDestroyed(ServletContextEvent event) {
   super.contextDestroyed(event);
   client.close();
    }

I made ESClient.java singleton as below


public class ESClient {
private Client client = null;
private static ESClient esClient = null;
 /**
 * 
 */
private ESClient() {
if (client == null) {
/*Settings settings = 
ImmutableSettings.settingsBuilder().put("transport.tcp.connect_timeout", 
"1000").build();
client = new TransportClient(settings).addTransportAddress(new 
InetSocketTransportAddress("127.0.0.1", 9300)); */
client = new TransportClient().addTransportAddress(new 
InetSocketTransportAddress("127.0.0.1", 9300));
}
}
 public static ESClient getInstance( ) {
 if(esClient==null) {
 esClient = new ESClient();
 }
     return esClient;
   }
   
public Client getClient() {
return client;
}
}

But i still get error saying

15:54:02,460 INFO  [transport] [Tyr] failed to get node info for 
[#transport#-1][BLRD17730][inet[/127.0.0.1:9300]], disconnecting...
java.lang.NoClassDefFoundError: 
org/elasticsearch/transport/SendRequestTransportException

Please let me know if i am doing anything wrong.

Thanks,
Vijaya

On Wednesday, December 24, 2014 6:21:21 PM UTC+5:30, Jörg Prante wrote:
>
> I recommend ServletContextListener for the client instance.
>
> Jörg
>
> On Wed, Dec 24, 2014 at 9:14 AM, Vijayakumari B N <[email protected] 
> <javascript:>> wrote:
>
>> Hi Jorg,
>>
>> I am not using ServletContextListener for client instance. I have shared 
>> the code above for creating client. But i am not closing the client. I 
>> tried closing the client that did not make any difference.
>>
>> Thanks,
>> Vijaya
>>
>> On Tuesday, December 23, 2014 10:27:13 PM UTC+5:30, Jörg Prante wrote:
>>>
>>> JBoss performed a double close in concurrency to ES which actually was 
>>> still active in closing down itself. Check if you are using a 
>>> ServletContextListener for the client instance. There are 
>>>  contextInitialized()/contextDestroyed() methods which are called by 
>>> JBoss exactly once during the life cycle of a web application.
>>>
>>> Jörg
>>>
>>> On Tue, Dec 23, 2014 at 3:09 PM, vineeth mohan <[email protected]> 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Hope you are using maven or else there are hell lot of dependent jars 
>>>> you have to include yourself.
>>>>
>>>> Thanks
>>>>               Vineeth
>>>> On Dec 23, 2014 4:54 PM, "Vijayakumari B N" <[email protected]> 
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I used only one jar for elasticsearch i.e. elasticsearch-1.4.1.jar, i 
>>>>> don't think we need any other jars apart from this and my elastic server 
>>>>> is 
>>>>> also running. Please let me know if there are any additional jars which i 
>>>>> need to add.
>>>>>
>>>>> Thanks,
>>>>> Vijaya
>>>>>
>>>>> On Tuesday, December 23, 2014 2:38:43 PM UTC+5:30, vineeth mohan wrote:
>>>>>>
>>>>>> Hi , 
>>>>>>
>>>>>> Make sure all the dependent JAR files are present. 
>>>>>> Its missing some of these.
>>>>>>
>>>>>> Thanks
>>>>>>             Vineeth
>>>>>>
>>>>>> On Tue, Dec 23, 2014 at 11:15 AM, Vijayakumari B N <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I get the below error when i tried to restart my jboss server after 
>>>>>>> integrating with elastic server. I am using elastic search 1.4 version. 
>>>>>>> Can 
>>>>>>> some one let me know where i am doing wrong. Elastic server absolutely 
>>>>>>> work 
>>>>>>> fine apart from below error.
>>>>>>>
>>>>>>> public static Client getESClient() {
>>>>>>> if (esClient == null) {
>>>>>>>  Client esClient = new TransportClient().addTransportAddress(new 
>>>>>>> InetSocketTransportAddress("127.0.0.1", 9300));       
>>>>>>>         return esClient;
>>>>>>> }
>>>>>>> return esClient;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2014-12-23 10:44:46,933 INFO  
>>>>>>> [org.apache.catalina.loader.WebappClassLoader] 
>>>>>>> Illegal access: this web application instance has been stopped already. 
>>>>>>>  
>>>>>>> Could not load org.elasticsearch.transport.Se
>>>>>>> ndRequestTransportException.  The eventual following stack trace is 
>>>>>>> caused by an error thrown for debugging purposes as well as to attempt 
>>>>>>> to 
>>>>>>> terminate the thread which caused the illegal access, and has no 
>>>>>>> functional 
>>>>>>> impact.
>>>>>>> java.lang.IllegalStateException
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1244)
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1204)
>>>>>>> at org.elasticsearch.transport.TransportService.sendRequest(Tra
>>>>>>> nsportService.java:213)
>>>>>>> at org.elasticsearch.transport.TransportService.submitRequest(T
>>>>>>> ransportService.java:177)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> SimpleNodeSampler.doSample(TransportClientNodesService.java:349)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> NodeSampler.sample(TransportClientNodesService.java:288)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> ScheduledNodeSampler.run(TransportClientNodesService.java:321)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>>>> Executor.java:1145)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>>>> lExecutor.java:615)
>>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>>> 2014-12-23 10:44:46,935 INFO  [org.elasticsearch.client.transport] 
>>>>>>> [Hammerhead] failed to get node info for [#transport#-1][BLRD17730][
>>>>>>> inet[/127.0.0.1:9300]], disconnecting...
>>>>>>> java.lang.NoClassDefFoundError: org/elasticsearch/transport/Se
>>>>>>> ndRequestTransportException
>>>>>>> at org.elasticsearch.transport.TransportService.sendRequest(Tra
>>>>>>> nsportService.java:213)
>>>>>>> at org.elasticsearch.transport.TransportService.submitRequest(T
>>>>>>> ransportService.java:177)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> SimpleNodeSampler.doSample(TransportClientNodesService.java:349)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> NodeSampler.sample(TransportClientNodesService.java:288)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> ScheduledNodeSampler.run(TransportClientNodesService.java:321)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>>>> Executor.java:1145)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>>>> lExecutor.java:615)
>>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>>> Caused by: java.lang.ClassNotFoundException: 
>>>>>>> org.elasticsearch.transport.SendRequestTransportException
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1358)
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1204)
>>>>>>> ... 8 more
>>>>>>> 2014-12-23 10:44:46,943 INFO  
>>>>>>> [org.apache.catalina.loader.WebappClassLoader] 
>>>>>>> Illegal access: this web application instance has been stopped already. 
>>>>>>>  
>>>>>>> Could not load org.elasticsearch.common.netty.channel.Channels$4.  
>>>>>>> The eventual following stack trace is caused by an error thrown for 
>>>>>>> debugging purposes as well as to attempt to terminate the thread which 
>>>>>>> caused the illegal access, and has no functional impact.
>>>>>>> java.lang.IllegalStateException
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1244)
>>>>>>> at org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
>>>>>>> pClassLoader.java:1204)
>>>>>>> at org.elasticsearch.common.netty.channel.Channels.fireChannelD
>>>>>>> isconnectedLater(Channels.java:383)
>>>>>>> at org.elasticsearch.common.netty.channel.socket.nio.AbstractNi
>>>>>>> oWorker.close(AbstractNioWorker.java:362)
>>>>>>> at org.elasticsearch.common.netty.channel.socket.nio.NioClientS
>>>>>>> ocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:58)
>>>>>>> at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.
>>>>>>> sendDownstream(DefaultChannelPipeline.java:574)
>>>>>>> at org.elasticsearch.common.netty.channel.Channels.close(Channe
>>>>>>> ls.java:812)
>>>>>>> at org.elasticsearch.common.netty.channel.AbstractChannel.close
>>>>>>> (AbstractChannel.java:197)
>>>>>>> at org.elasticsearch.transport.netty.NettyTransport$NodeChannels.
>>>>>>> closeChannelsAndWait(NettyTransport.java:1107)
>>>>>>> at org.elasticsearch.transport.netty.NettyTransport$NodeChannel
>>>>>>> s.close(NettyTransport.java:1093)
>>>>>>> at org.elasticsearch.transport.netty.NettyTransport.disconnectF
>>>>>>> romNode(NettyTransport.java:883)
>>>>>>> at org.elasticsearch.transport.TransportService.disconnectFromNode(
>>>>>>> TransportService.java:158)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> SimpleNodeSampler.doSample(TransportClientNodesService.java:372)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> NodeSampler.sample(TransportClientNodesService.java:288)
>>>>>>> at org.elasticsearch.client.transport.TransportClientNodesService$
>>>>>>> ScheduledNodeSampler.run(TransportClientNodesService.java:321)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>>>> Executor.java:1145)
>>>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>>>> lExecutor.java:615)
>>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Vijaya
>>>>>>>
>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "elasticsearch" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/elasticsearch/dcba912a-787
>>>>>>> 8-4397-a203-401c31e5bb24%40googlegroups.com 
>>>>>>> <https://groups.google.com/d/msgid/elasticsearch/dcba912a-7878-4397-a203-401c31e5bb24%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>  -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "elasticsearch" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>> msgid/elasticsearch/d515aa3c-febe-4a03-a8d5-5f175c08e8fa%
>>>>> 40googlegroups.com 
>>>>> <https://groups.google.com/d/msgid/elasticsearch/d515aa3c-febe-4a03-a8d5-5f175c08e8fa%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>  -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "elasticsearch" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/elasticsearch/CAGdPd5nL-vohpRe7eW5FoakPAu_c3xHAk1Z59Z%
>>>> 3D5v%3DZgpsX5Ag%40mail.gmail.com 
>>>> <https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nL-vohpRe7eW5FoakPAu_c3xHAk1Z59Z%3D5v%3DZgpsX5Ag%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/b9b2a6ec-9149-40a1-83e1-404ed9bb5b2f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/b9b2a6ec-9149-40a1-83e1-404ed9bb5b2f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/22b07930-a8f1-4a24-a73e-5b77a02183b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to