简体   繁体   English

Memcache的get方法抛出IOException

[英]Memcache get method throws IOException

When trying get in memcache client, getting the below excepton. 尝试获取Memcache客户端时,获取以下内容。

Caused by: java.io.IOException: com.fet.myclass.webservice.data.DataList
    at com.schooner.MemCached.ObjectTransCoder.decode(Unknown Source)

Please help. 请帮忙。 Thanks. 谢谢。

EDIT: 编辑:

DataList is my own object. DataList是我自己的对象。 Is there any constraints like, only native java objects can be cached, like that? 有没有类似的约束,像这样只能缓存本地Java对象?

The MemCached.ObjectTransCoder decode method rely on the java.io.ObjectInputStream to deserialize the cached Java objects from the cache. MemCached.ObjectTransCoder解码方法依赖于java.io.ObjectInputStream从缓存中反序列化缓存的Java对象。

So, first, you have to check that your DataList object is serializable. 因此,首先,您必须检查DataList对象是否可序列化。 That is: it implements the java.io.Serializable interface, and also all its class level attributes are primitive types or serializable objects by themselves. 也就是说:它实现了java.io.Serializable接口,并且其所有类级别属性本身都是原始类型或可序列化的对象。

Also, reviewing the component code listed here the decode methods are implemented in such a way that a ClassNotFoundException gets wrapped inside an IOExpcetion using the class name as its message, which seems to be happening here. 同样,查看此处列出的组件代码,以实现以下方法的方式实现解码方法:将ClassNotFoundException封装在使用类名作为其消息的IOExpcetion内,这似乎正在发生。

So, as a second point, you should check if the process where you are getting this error, has your class included at its classpath (via -cp argument, or whatever the case), and if the class name exposed at the error matches exactly you class full qualified name. 因此,作为第二点,您应该检查出现此错误的进程,是否将类包含在其类路径中(通过-cp参数或其他情况),以及在错误处公开的类名称是否完全匹配您将使用全限定名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM