KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Hi everyone i was working with memcache, and when i compiled this code i got following errors. 2010-07-09 10:35:53.499 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2010-07-09 10:35:53.520 INFO net.spy.memcached.MemcachedConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@7fdcde Exception in thread "main" java.lang.IllegalArgumentException: Non-serializable object at net.spy.memcached.transcoders.BaseSerializingTranscoder.serialize(BaseSerializingTranscoder.java:86) at net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:135) at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:301) at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:691) at def.Tweet.main(Tweet.java:23) Caused by: java.io.NotSerializableException: def.User at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) at net.spy.memcached.transcoders.BaseSerializingTranscoder.serialize(BaseSerializingTranscoder.java:81) ... 4 more I managed to fix it with converting User class toString but ı dont want to use toString method.I just want to use my class to add and get mwethods. How can i fix this problem? Here is the code i am using. package def; import java.io.IOException; import java.io.Serializable; import java.net.InetSocketAddress; import net.spy.memcached.MemcachedClient; public class Tweet { private static User user; private static Message message; private static Followers follower; public static void main(String[] args) throws Exception { try{ user = new User(1,"Mehmet Özer","asd","127.0.0.1","True","Onine"); //String deneme = user.toString(); MemcachedClient c=new MemcachedClient(new InetSocketAddress("localhost", 11211));
Tags (comma-separated)
Save Edits
Cancel