You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by HungChang <un...@gmail.com> on 2016/03/04 14:03:24 UTC
InetSocketAddress is not serializable
Hi,
I'm building the connector for ElasticSearch2. One main issue for me now is
that
List<TransportAddress> transports = new ArrayList<TransportAddress>();
transports.add(new InetSocketTransportAddress(new
InetSocketAddress(TransportAddress, 9300)));
throws
java.io.NotSerializableException:
org.elasticsearch.common.transport.InetSocketTransportAddress
ES2 changed to this way and InetSocketAddress implements
java.io.Serializable rather than Writable (is it the problem?).
What would be the suggested way to handle this? should I implement a
serializable InetSocketAddress?
Best,
Sendoh
--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-tp5296.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Re: InetSocketAddress is not serializable
Posted by HungChang <un...@gmail.com>.
Thank for your explanation.
Yes the InetSocketAddress you used is imported from java.net instead of
elaticsearh2. Very cool!
--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-when-building-ElasticSearch2-connector-tp5296p5303.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Re: InetSocketAddress is not serializable
Posted by Zach Cox <zc...@gmail.com>.
java.net.InetSocketAddress is Serializable [1] and implementations of
java.util.List (e.g. java.util.ArrayList [2]) are also usually Serializable.
Unfortunately, for some reason InetSocketTransportAddress [3] is no longer
Serializable in Elasticsearch 2.x. :(
-Zach
[1] http://docs.oracle.com/javase/8/docs/api/java/net/InetSocketAddress.html
[2] http://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html
[3]
http://javadoc.kyubu.de/elasticsearch/HEAD/org/elasticsearch/common/transport/InetSocketTransportAddress.html
On Fri, Mar 4, 2016 at 8:39 AM HungChang <un...@gmail.com> wrote:
> Can I ask why List<InetSocketAddress> can become serilizable?
>
> Best,
>
> Sendoh
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-when-building-ElasticSearch2-connector-tp5296p5299.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>
Re: InetSocketAddress is not serializable
Posted by HungChang <un...@gmail.com>.
Can I ask why List<InetSocketAddress> can become serilizable?
Best,
Sendoh
--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-when-building-ElasticSearch2-connector-tp5296p5299.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Re: InetSocketAddress is not serializable
Posted by HungChang <un...@gmail.com>.
Thank you. Very nice usage and It works!
--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-when-building-ElasticSearch2-connector-tp5296p5298.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Re: InetSocketAddress is not serializable
Posted by Zach Cox <zc...@gmail.com>.
I ran into the same issue upgrading to Elasticsearch 2, here's how I solved
it:
https://gist.github.com/zcox/59e486be7aeeca381be0#file-elasticsearch2sink-java-L110
-Zach
On Fri, Mar 4, 2016 at 7:30 AM HungChang <un...@gmail.com> wrote:
> Hi,
>
> I'm building the connector for ElasticSearch2. One main issue for me now is
> that
>
> List<TransportAddress> transports = new ArrayList<TransportAddress>();
> transports.add(new InetSocketTransportAddress(new
> InetSocketAddress(TransportAddress, 9300)));
>
> throws
> java.io.NotSerializableException:
> org.elasticsearch.common.transport.InetSocketTransportAddress
>
> ES2 changed to this way and InetSocketAddress implements
> java.io.Serializable rather than Writable (is it the problem?).
> What would be the suggested way to handle this? should I implement a
> serializable InetSocketAddress?
>
> Best,
>
> Sendoh
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-tp5296.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>