invalid stream header: 31323334

记录一下,都配置好了之后,用java客户端设置key-value,在服务器get没有问题,然后再服务器端设置一个key-value,java客户端获取出错

转载一下网上同样问题的描述,以及解决方案

严重: ++++ exception thrown while trying to get object from cache for key: test1
2013-6-26 23:18:37 com.schooner.MemCached.AscIIClient get
严重: invalid stream header: 6675636B
java.io.StreamCorruptedException: invalid stream header: 6675636B
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at com.schooner.MemCached.ObjectTransCoder.decode(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.danga.MemCached.MemCachedClient.get(Unknown Source)
at com.libo.memcache.MemcachedCli.get(MemcachedCli.java:39)
at com.libo.memcache.MCTest.main(MCTest.java:17)

在网上查原因发现 
在memcached中,不同的客户端在set或者add值时,对命令的第二个参数的使用是不一致的
<command name> <key> <flags> <exptime> <bytes>
< data block>
JAVA客户端flags字段填写的都是32,不是32的是无法通过java客户端get出来的
所以在通过memcached admin进行数据set时,需要显示指定flags值为32
set testkey 32 0 5
12345
如此放入缓存后,通过java客户端是可以取出来的。

时间: 2024-10-08 15:28:40

invalid stream header: 31323334的相关文章

java——解决java.io.StreamCorruptedException: invalid stream header: xxx

这个错误是由序列化引起的,可能的原因以及解决方法: 1.kryo对于集合(比如 Map)的反序列化会失效,报这个错误,解决办法比较暴力,不用kryo了,直接用java原生方法. 2.使用Java原生方法要注意,序列化和反序列化的方式,不能直接使用str.getBytes()获取二进制流,应该使用序列化方式获取二进制流: https://blog.csdn.net/weixin_33881050/article/details/87100661 3.对于Map仍然序列化失败,这时候可以将Map对象

运行django项目出现Invalid HTTP_HOST header: &#39;192.168.1.111:8000&#39;. You may need to add &#39;192.168.1.111&#39; to ALLOWED_HOSTS

Request Method: GET Request URL: http://202.201.38.70:8000/angular Django Version: 1.11.3 Exception Type: DisallowedHost Exception Value: Invalid HTTP_HOST header: '202.201.38.70:8000'. You may need to add '202.201.38.70' to ALLOWED_HOSTS. Exception

create-react-app之Invalid Host Header

[create-react-app之Invalid Host Header] 1.When you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. yo

启动TOMCAT报错 java.util.zip.ZipException: invalid LOC header (bad signature)

报错信息大致如下所示: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) at org.apache.catalina.startup.Bootstrap.main(Bootstr

invalid LOC header (bad signature)错误与 java.lang.ClassFormatError: com/mysql/jdbc错误

1,报错信息如下: SEVERE: Resource read error: Could not load org.springframework.jmx.support.MetricType. java.util.zip.ZipException: invalid LOC header (bad signature) <span style="white-space:pre"> </span>at java.util.zip.ZipFile.read(Nati

Django运行访问项目出现的问题:Invalid HTTP_HOST header: &#39;192.168.114.25:8001&#39;. You may need to add u&#39;192.168.114.25&#39; to ALLOWED_HOSTS.

当运行python manage.py runserver 0.0.0.0:8001时候,出现Invalid HTTP_HOST header: '192.168.114.25:8001'. You may need to add u'192.168.114.25' to ALLOWED_HOSTS. 解决办法:django-admin.py startproject project-name创建的项目中去修改 setting.py 文件: ALLOWED_HOSTS = ['*'] Djang

[转]maven编译时出现读取XXX时出错invalid LOC header (bad signature)

maven编译时出现读取XXX时出错invalid LOC header (bad signature) 一.发现问题右击pom.xml,run as —> maven install,会看到console中有时报mavenRepository\repos\org\mortbay\jetty\servlet-api-2.5\6.1H.14.1\servlet-api-2.5-6.1H.14.1.jar时出错等某些包的报错等类似信息,pom.xml显示红叉. 二.原因分析该包没有下载正确. 三.解

nodejs 项目,请求返回Invalid Host header问题

今天在linux上安装node,使用node做一个web服务器,在linux上安装各种依赖以后开始运行但是,出现了:Invalid Host header 的样式,在浏览器调试中发现是node返回的错误! 于是就百度,最后找到了一个解决的方法,(看的别人的). 是webpack-dev-server版本更新了的问题. 解决问题的方法: 添加配置信息 disableHostCheck: true // 启动服务 var app = new WebpackDevServer(webpack(conf

tomcat启动出错 invalid LOC header

异常详情 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at