从Websphere使用Elasticsearch Java Client时出错

时间:2015-07-13 19:13:49

标签: java elasticsearch websphere elasticsearch-java-api

我有一个使用elasticsearch官方java客户端的Web应用程序。在使用IBM JVM Java 7在Websphere 8.5.5上使用该Web应用程序时,我收到以下错误。我尝试使用传输客户端和节点客户端。还尝试使用Oracle JavaSE 7和8作为Elasticsearch的JVM。但没有成功。 Elasticsearch不在IBM JVM上运行,而Websphere仅在IBM JVM上运行。

有没有人知道从Websphere上的应用程序使用elasticsearch官方java客户端的方法?

以下是错误堆栈跟踪:

Caused by: org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:178)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:130)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:626)
at java.lang.Thread.run(Thread.java:780)
Caused by: java.io.StreamCorruptedException: unexpected end of block data
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1438)
    at java.io.ObjectInputStream.access$400(ObjectInputStream.java:217)
    at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2201)
    at java.io.ObjectInputStream.readFields(ObjectInputStream.java:603)
    at java.net.InetSocketAddress.readObject(InetSocketAddress.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1076)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1941)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1846)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1416)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2039)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1963)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1846)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1416)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2039)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1963)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1846)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1416)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:419)
    at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:176)
    ... 23 more

1 个答案:

答案 0 :(得分:2)

此问题的唯一解决方法是为两个Java应用程序使用相同的JVM。使用不同更新版本的相同 JVM之间的Java异常序列化可能不一致,显然这是IBM的JVM与您使用Elasticsearch运行的JVM之间的问题。

具体来说,Elasticsearch不能在IBM JVM上运行,因为IBM JVM has bugs in it that prevent it from working correctly

幸运的是,前景在这里变得更好 IBM is working with Elasticsearch to get it working properly Elasticsearch is removing serialization in Elasticsearch 2.0