Mark Needham

Thoughts on Software Development

Neo4j Backup: java.lang.ClassCastException: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to org.neo4j.cluster.com.message.Message

with one comment

When using Neo4j’s online backup facility there are two ways of triggering it, either by using the ‘single://‘ or ‘ha://‘ syntax and these behave slightly differently.

If you’re using the ‘single://’ syntax and don’t specify a port then it will connect to ’6362′ by default:

./neo4j-backup -from single://192.168.1.34 -to /mnt/backup/neo4j-backup

If you’ve changed the backup port via the ‘online_backup_server’ property in conf/neo4j.properties you’ll need to set the port explicitly:

online_backup_server=192.168.1.34:6363
./neo4j-backup -from single://192.168.1.34:6363 -to /mnt/backup/neo4j-backup

If you’re using the ‘ha://’ syntax then the backup client joins the HA cluster, works out which machine is the master and then creates a backup from that machine.

In order for the backup client to join the cluster it connects to port ’5001′ by default:

./neo4j-backup -from ha://192.168.1.34 -to /mnt/backup/neo4j-backup

If you’ve changed the ‘ha.cluster_server’ property then you’ll need to set the port explicitly:

ha.cluster_server=192.168.1.34:5002
./neo4j-backup -from ha://192.168.1.34:5002 -to /mnt/backup/neo4j-backup

A mistake that I made when first using this utility was to use the ‘ha://’ syntax with the backup port. e.g.

./neo4j-backup -from ha://192.168.1.34:6362 -to /mnt/backup/neo4j-backup

If you do this you’ll end up with the following exception:

2014-01-19 19:24:30.842+0000 ERROR [o.n.c.c.NetworkSender]: Receive exception:
java.lang.ClassCastException: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to org.neo4j.cluster.com.message.Message
	at org.neo4j.cluster.com.NetworkSender$NetworkMessageSender.messageReceived(NetworkSender.java:409) ~[neo4j-cluster-2.0.0.jar:2.0.0]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.6.3.Final.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
	at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

Let me know in the comments if any of this doesn’t make sense. There are lots of other examples to follow on neo4j-backup’s man page in the manual as well.

Be Sociable, Share!

Written by Mark Needham

January 19th, 2014 at 7:29 pm

Posted in neo4j

Tagged with