java分布式部署的时候执行request.getSession().setAttribute("VO",Object);时报setAttribute: Non-serializable attribute异常,这的问题有如下几种解决方法
1、在你的项目不要经过分布试部署的时候比较简单:去掉web.xml中的 <distributable/> 就行了。
2、在你的项目要通过分部试部署的时候,首先是要将你写入的绑定对象进行序列化,再进行入request.getSession().setAttribute("VO",绑定对象)操作。其方法是:
让绑定类实现一下序列化接口即 implements java.io.Serializable。
注意:
这样在不管是在分布试部署还是在非分布试部署都不会有问题了。不过序列化之后会让服务器的负载加重,没有必要的话不建议序列化。
相关推荐
tomcat8-redis-cluster概要 1.原理: 原理就是继承tomcat的manager接口,接管session的持久化...必须手动的调用session的setAttribute方法,才能同步到你的存储里面,因为分布式session的应用可能不在同一个jvm上面
tomcat7-redis-cluster概要 1.原理: 原理就是继承tomcat的manager接口,接管session的持久化...必须手动的调用session的setAttribute方法,才能同步到你的存储里面,因为分布式session的应用可能不在同一个jvm上面
tomcat-redis-session-manager-jre7-tomcat6.jar smartcard中的代码需要修改,redis放值时不能为空 //保存sysOrg中工号所属地市区县 Struts2Utils.getSession().setAttribute(Constants.JCFX_CITY, orgList.get...
The method setAttribute(String, Object) in the type ServletRequest is not applicable for the arguments (String, double) y2ssh.sg.chp1.action.AddAction.execute(AddAction.java:18) y2ssh.sg.chp1....
实用并研究Java servlet。 3.2装箱第一网 url:http://localhost:8080/HelloApp/login.htm code:3-1,3-2,3-3 1.doGet and doPost in the Servlet 2.url 3.new initParams setting method in servlet3.0 4....
<!..._position:;min-height:100%}#head{padding-bottom:100px;text-align:center;*z-index:1}#ftCon{height:100px;position:absolute;...list-style:none}body,form,#fm{position:relative}td{text-align:left}img{border...
但通常情况下,由于Java Bean是被容器所创建(如Tomcat)的,所以Java Bean应具有一个无参的构造器,另外,通常Java Bean还要实现Serializable接口用于实现Bean的持久性。Java Bean实际上相当于微软COM模型中的本地...
xmlUtils.setAttribute(root,'testId','test0000000000'); alert(xmlUtils.toString(root)); //删除第一个节点 publish xmlUtils.removeChild(xmlUtils.getNodesByXpath('//root/publish')[0]); alert...
bool PDO::setAttribute ( int $attribute , mixed $value ) 设置数据库句柄属性。下面列出了一些可用的通用属性;有些驱动可能使用另外的特定属性。 _PDO::ATTRCASE :强制列名为指定的大小写。 _PDO::CASELOWER ...
但通常情况下,由于Java Bean是被容器所创建(如Tomcat)的,所以Java Bean应具有一个无参的构造器,另外,通常Java Bean还要实现Serializable接口用于实现Bean的持久性。Java Bean实际上相当于微软COM模型中的本地...
<br>if (Name.equals("mike") && Password.equals("1234")) { session.setAttribute("Login", "OK"); response.sendRedirect("Member.jsp"); } else { out.println("登录错误,请输入正确名称...
用与java web 开发,java 实现的数字验证码的生成 class Image{} *" %> <jsp:useBean id="image" scope="session" class="myclass.test.Image"/> //设置页面不缓存 response.setHeader("Pragma","No-cache"); ...
Notification that an attribute has been added to a session. attributeAdded(ServletContextAttributeEvent) - Method in interface javax.servlet.ServletContextAttributeListener Notification that a new ...
request.setAttribute(“currentTimeStamp”,Calendar.getInstance().getTime()); %> 显示:2009-11 ”yyyy-MM” value=”${currentTimeStamp}”/> 显示:2009-11-30 23:47:06 ”yyyy-MM-dd value=”${current...
基于MVC的小项目 ... session.setAttribute("userName", name); session.setAttribute("pwd", pwd); session.setAttribute("msgList", msgList); response.sendRedirect("jspPages/index.jsp"); } } }
Ajax请求session超时处理流程 java服务器端处理: SessionValidateFilter中修改: if (ServerInfo.isAjax(request)) { request.setAttribute("statusCode", 301); request.setAttribute("message", "Session ...
request.getSession().setAttribute("UserAccessToken",token); } request.setAttribute("openid", token.getOpenid()); request.setAttribute("accessToken", token.getAccessToken()); request....
Attribute是属性的意思,文章仅对部分兼容IE和FF的Attribute相关的介绍。 attributes:获取一个属性作为对象 getAttribute:获取某一个属性的值 setAttribute:建立一个属性,并同时给属性捆绑一个值 ...
bool PDO::setAttribute ( int $attribute , mixed $value ) 设置数据库句柄属性。下面列出了一些可用的通用属性;有些驱动可能使用另外的特定属性。 参数 $attribute PDO::ATTR_CASE:强制列名为指定的大小写。他...
计算机后端-PDO13PDO对象的setAttribute方法.avi