So I am trying to send a message across the cluster, the message will contain a User object which is a Serializable class.
When I send a String or an int it works perfectly, the message is sent without a problem and all channels on the cluster receive it.
When I try to send my own object User it gives me this exception;
Dec 7, 2013 3:55:19 PM org.jgroups.logging.JDKLogImpl error
SEVERE: JGRP000019: failed passing message to receiver: %s
java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: User
at org.jgroups.Message.getObject(Message.java:378)
at AuctionImpl$ReceiverClass.receive(AuctionImpl.java:151)
at org.jgroups.JChannel.up(JChannel.java:738)
This is my receive code;
public void receive(Message msg) {
User user = (User) msg.getObject();
System.out.println("Username: " + user.getUsername());
}
The odd thing is I can create a new instance of User inside the receive and get no problems. for example;
public void receive(Message msg) {
User user = new User("Test", "Test");
User user = (User) msg.getObject();
System.out.println("Username: " + user.getUsername());
}
Anyone got any ideas?
Take a look at the ClassNotFoundException: your User class is not on the classpath when running your program.